Bug #62228 [Nab]: equal operator does not correct
| From: | laruence@php.net | Date: | Tue, 05 Jun 2012 05:36:29 +0000 |
| Subject: | Bug #62228 [Nab]: equal operator does not correct | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171037@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62228&edit=1
ID: 62228
Updated by: laruence@php.net
Reported by: starway49 at hotmail dot com
Summary: equal operator does not correct
Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: ALL
PHP Version: 5.3.13
Block user comment: N
Private report: N
New Comment:
s#convert to integer#convert to number#g
Previous Comments:
------------------------------------------------------------------------
[2012-06-05 05:32:18] laruence@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
0x00 -> hex 0
0e04 -> science nonation 0 * 10^4
they all are numeric string. php will convert them to integer before comparing.
------------------------------------------------------------------------
[2012-06-05 02:51:59] starway49 at hotmail dot com
Description:
------------
this problom may happen in PHP5.2~5.4
<?php
echo '0X00' == '0E04'; //return 1
if ('0X00' == '0E04') {
echo '0X00 = 0E04'; //the answer is true?!
}
?>
Test script:
---------------
<?php
echo '0X00' == '0E04'; //return 1
if ('0X00' == '0E04') {
echo '0X00 = 0E04'; //the answer is true
}
?>
Expected result:
----------------
if ('0X00' == '0E04')
this should return false.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62228&edit=1