#41814 [Opn->Bgs]: String comparison changed

From: Date: Wed, 27 Jun 2007 09:23:36 +0000
Subject: #41814 [Opn->Bgs]: String comparison changed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-114313@lists.php.net to get a copy of this message
ID: 41814 Updated by: tony2001@php.net Reported By: thomas dot hebinck at digionline dot de -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 5.2.3 New Comment: The current behaviour is correct. >The two integers are not the same They are not integers in the first place, they are floats. Remove the quotes and you'll get the very same result. Previous Comments: ------------------------------------------------------------------------ [2007-06-27 09:10:39] thomas dot hebinck at digionline dot de The problem is, that the behaviour changed from 5.2.0. to 5.2.1. The two integers are not the same - they are just both out of range. It seems that PHP 5.2.0 didn't convert strings with out of range integers to integer while comparing, but PHP 5.2.1 does. ------------------------------------------------------------------------ [2007-06-27 08:23:44] tony2001@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You are comparing two numeric strings. http://www.php.net/manual/en/language.operators.comparison.php ------------------------------------------------------------------------ [2007-06-26 18:46:06] thomas dot hebinck at digionline dot de Description: ------------ The behaviour of the comparison of strings containing integers changed from PHP 5.2.0 to 5.2.1. Reproduce code: --------------- echo (int)('0x100000000000000000'=='0x100000000000000001'); Expected result: ---------------- 0 // this was the result in PHP <= 5.2.0 Actual result: -------------- 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41814&edit=1

« previous php.bugs (#114313) next »