|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-04-30 17:51 UTC] simon at stienen dot name
[2009-06-02 08:36 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 13:00:02 2025 UTC |
Description: ------------ when the integer overflows it is converted to double but it is not done in vice versa. Hence i fell: it is not done from double to long. Hence in the function increment_function(zend_operators.c) we have to add the validation as follows case IS_DOUBLE: if(op1->value.dval == LONG_MIN) { op1->value.lval = (long) op1->value.dval+1; op1->type = IS_LONG; }else{ op1->value.dval = op1->value.dval + 1; } Reproduce code: --------------- <? $vValue = -2147483647; var_dump($vValue); //output: int(-2147483647) $vValue--; var_dump($vValue); //output: float(-2147483648) $vValue--; var_dump($vValue); //output: float(-2147483649) $vValue++; var_dump($vValue);//output: float(-2147483648) $vValue++; var_dump($vValue);//output: float(-2147483647) ?> Expected result: ---------------- int(-2147483647) int(-2147483648) float(-2147483649) int(-2147483648) int(-2147483647) Actual result: -------------- int(-2147483647) int(-2147483648) float(-2147483649) float(-2147483648) float(-2147483647)