|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-05-05 20:36 UTC] whatrevolution at yahoo dot com
[2016-07-13 13:52 UTC] dmitry@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: dmitry
[2016-07-13 13:52 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 19:00:01 2025 UTC |
Description: ------------ In zend_operators.c the function ZEND_API int bitwise_not_function(..) handles a double by doing a c cast to a long "if (op1->type == IS_DOUBLE) { op1->value.lval = (long) op1->value.dval; op1->type = IS_LONG; }" but all other operators use the zendi_convert_to_long() macro so not isn't consistent with the other operators. this can result in an unexpected value as shown in the test case Reproduce code: --------------- <?php define("MAX_64Bit", 9223372036854775807); $e = (MAX_64Bit + 1); $f = (int)$e; var_dump(~(MAX_64Bit + 1)); var_dump(~$f); ?> Expected result: ---------------- int(-9223372036854775808) int(-9223372036854775808) Actual result: -------------- int(9223372036854775807) int(-9223372036854775808)