Bug #53584 [NEW]: Asterisk character equals 0
| From: | andy dot mezey at gmail dot com | Date: | Mon, 20 Dec 2010 20:45:12 +0000 |
| Subject: | Bug #53584 [NEW]: Asterisk character equals 0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-157155@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux
PHP version: 5.3.4
Package: Output Control
Bug Type: Bug
Bug description:Asterisk character equals 0
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 bug report at http://bugs.php.net/bug.php?id=53584&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53584&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53584&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53584&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53584&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53584&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53584&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53584&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53584&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53584&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53584&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53584&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53584&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53584&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53584&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53584&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53584&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53584&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53584&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53584&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53584&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53584&r=mysqlcfg