Skip to content

Commit

Permalink
Crypt/Base: improve ARM detection code
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Oct 7, 2023
1 parent 6cd6e8c commit 173bb38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions phpseclib/Crypt/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,13 @@ function __construct($mode = CRYPT_MODE_CBC)
if (!defined('CRYPT_BASE_USE_REG_INTVAL')) {
switch (true) {
// PHP 5.3, per http://php.net/releases/5_3_0.php, introduced "more consistent float rounding"
case version_compare(PHP_VERSION, '5.3.0') >= 0 && (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
case version_compare(PHP_VERSION, '5.3.0') >= 0 && !(is_string(php_uname('m')) && (php_uname('m') & "\xDF\xDF\xDF") == 'ARM'):
// PHP_OS & "\xDF\xDF\xDF" == strtoupper(substr(PHP_OS, 0, 3)), but a lot faster
case (PHP_OS & "\xDF\xDF\xDF") === 'WIN':
case PHP_INT_SIZE == 8:
define('CRYPT_BASE_USE_REG_INTVAL', true);
break;
case (php_uname('m') & "\xDF\xDF\xDF") == 'ARM':
case is_string(php_uname('m')) && (php_uname('m') & "\xDF\xDF\xDF") == 'ARM':
switch (true) {
// PHP_VERSION_ID wasn't a constant until PHP 5.2.7
case version_compare(PHP_VERSION, '5.3.0') < 1:
Expand Down

1 comment on commit 173bb38

@terrafrost
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1949

Please sign in to comment.