make PHP 8.1 32-bit changes compatable with raspberry pi's

This commit is contained in:
terrafrost 2022-09-13 23:56:13 -05:00
parent 2ab212300e
commit 51cafda4a3
2 changed files with 6 additions and 3 deletions

View File

@ -371,7 +371,7 @@ class Math_BigInteger
break; break;
case MATH_BIGINTEGER_MODE_BCMATH: case MATH_BIGINTEGER_MODE_BCMATH:
// round $len to the nearest 4 (thanks, DavidMJ!) // round $len to the nearest 4 (thanks, DavidMJ!)
$len = (strlen($x) + 3) & 0xFFFFFFFC; $len = (strlen($x) + 3) & ~3;
$x = str_pad($x, $len, chr(0), STR_PAD_LEFT); $x = str_pad($x, $len, chr(0), STR_PAD_LEFT);

View File

@ -459,8 +459,11 @@ class Net_SFTP extends Net_SSH2
0x00002000 => 'NET_SFTP_ATTR_LINK_COUNT', 0x00002000 => 'NET_SFTP_ATTR_LINK_COUNT',
0x00004000 => 'NET_SFTP_ATTR_UNTRANSLATED_NAME', 0x00004000 => 'NET_SFTP_ATTR_UNTRANSLATED_NAME',
0x00008000 => 'NET_SFTP_ATTR_CTIME', 0x00008000 => 'NET_SFTP_ATTR_CTIME',
// intval is used because 0x80000000 will yield a floating point on 32-bit systems // 0x80000000 will yield a floating point on 32-bit systems and converting floating points to integers
intval(0x80000000) => 'NET_SFTP_ATTR_EXTENDED' // yields inconsistent behavior depending on how php is compiled. so we left shift -1 (which, in
// two's compliment, consists of all 1 bits) by 31. on 64-bit systems this'll yield 0xFFFFFFFF80000000.
// that's not a problem, however, and 'anded' and a 32-bit number, as all the leading 1 bits are ignored.
(PHP_INT_SIZE == 4 ? -1 : 0xFFFFFFFF) => 'NET_SFTP_ATTR_EXTENDED'
); );
$this->open_flags = array( $this->open_flags = array(
0x00000001 => 'NET_SFTP_OPEN_READ', 0x00000001 => 'NET_SFTP_OPEN_READ',