Adsense
Popular Posts
- Install APXS in Redhat Linux
- MySQL workbench -"Could not decrypt password cache"
- Transfer modules between sites
- JavaScript, remove trailing insignificant zeros after toFixed function
- Set Windows path command line
- datatable order by nunmeric
- MySQL date created and date modified
- super(props) in React
- PHP, dump varailbes in a format way
- React: connect(mapStateToProps, mapDispatchToProps)
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