Edit report at http://bugs.php.net/bug.php?id=53584&edit=1
ID: 53584 Updated by: [email protected] Reported by: andy dot mezey at gmail dot com Summary: Asterisk character equals 0 -Status: Open +Status: Bogus Type: Bug -Package: Output Control +Package: Scripting Engine problem Operating System: Linux PHP Version: 5.3.4 Block user comment: N Private report: N New Comment: Everything in your test script is expected behavior. "*" == "0" being true is not, but that claim isn't tested in the test script and I can't reproduce, which leads me to conclude it was a mistake on the your part. php -r 'var_dump("*" == "0");' bool(false) Previous Comments: ------------------------------------------------------------------------ [2010-12-20 21:45:11] andy dot mezey at gmail dot com Description: ------------ Using PHP Version 5.3.2-1ubuntu4.5. When a variable holds the value "*" and when being compared against the values 0 or "0" using the equal operator, true is always returned. I did look here: http://php.net/manual/en/language.types.type-juggling.php and I do not see a reason for this behavior. The Identical operator does however return false which is what you would expect. Test script: --------------- $var1 = "*"; if( $var1 == 0 ) { echo "ok"; } switch( $var1 ) { case 0 : echo "ok"; break; } $var2 = "\*"; if( $var2 == 0 ) { echo "ok"; } switch( $var2 ) { case 0 : echo "ok"; break; } Expected result: ---------------- Should return false. Actual result: -------------- Returns true; ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53584&edit=1
