Adsense
Popular Posts
- Code update from PHP 7.4 to PHP 8.1 - PhpSpreadsheet
- MySQL workbench -"Could not decrypt password cache"
- Code update from PHP 7.4 to PHP 8.1 - Worksheet/Iterator.php
- Rendering HTML tags inside textarea
- axios handle blob type data
- Unix Utils and wget in Windows
- increase mysql query speed
- Setup vi syntax for PHP
- Get WAMP running on EC2
- EXCEL return to the next line in the same cell
Friday, November 23, 2018
Left shift operation in PHP when upgrading from PHP5 to PHP 7
1<< -1 is OK for PHP 5, but fails for PHP 7.
Directly using 1<< -1 = -9223372036854775808
(Obtained from PHP Sandbox http://sandbox.onlinephpfunctions.com/)
/var/www/html/new6sp/application/controllers/ttr_view.php
line 781 change from
if($rcode < 33) {
$code = 1 << $rcode;
$r[$sid]['terms'][$term]['code'] |= $code;
}else{
$code = 1 << ($rcode-33);
$r[$sid]['terms'][$term]['code_upper'] |= $code;
}
to
if($rcode < 0) {
$code = -9223372036854775808;
$r[$sid]['terms'][$term]['code'] |= $code;
}
elseif($rcode < 33) {
$code = 1 << $rcode;
$r[$sid]['terms'][$term]['code'] |= $code;
}else{
$code = 1 << ($rcode-33);
$r[$sid]['terms'][$term]['code_upper'] |= $code;
}
Labels:
php
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment