#49418 [NEW]: The greatest bug in the history of PHP

From: Date: Sun, 30 Aug 2009 17:29:54 +0000
Subject: #49418 [NEW]: The greatest bug in the history of PHP
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-141719@lists.php.net to get a copy of this message
From: ilies dot radu at gmail dot com Operating system: MacOSX, NetBSD, Linux PHP version: 5.2.10 PHP Bug Type: Variables related Bug description: The greatest bug in the history of PHP Description: ------------ ---- Example #1 / FAIL (This should NOT FAIL, but it does) !!!!!!!!!!! $a=1.3333; $b=1.6666; $c=2.9999; $d=($a+$b); if($d != $c) { echo 'php have a serious bug ...'; } else { echo 'OK ...'; } //end if else // notice that currently I use number_format($d, 4, '.', '') to fix this, but is abnormal ! ---- ---- Example #2 / OK $a=4.3333; $b=4.6666; $c=8.9999; $d=($a+$b); if($d != $c) { echo 'php have a serious bug ...'; } else { echo 'OK ...'; } //end if // this seems that not raise that bug, ... hmmm ... very strange ---- I tested it on: PHP 4.4.9 PHP 5.2.9 PHP 5.2.10 PHP 4.4.4 (bundled with Zend Studio) It appears that all fail at Example #1 and should not ... !!! If you release a patch, please also patch the 4.4.9 version. Reproduce code: --------------- $a=1.3333; $b=1.6666; $c=2.9999; $d=($a+$b); if($d != $c) { echo 'php have a serious bug ...'; } else { echo 'OK ...'; } //end if else Expected result: ---------------- the output should be 'OK ...' but is not ! Actual result: -------------- 'php have a serious bug ...' -- Edit bug report at http://bugs.php.net/?id=49418&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49418&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49418&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49418&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49418&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49418&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49418&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49418&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49418&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49418&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49418&r=support Expected behavior: http://bugs.php.net/fix.php?id=49418&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49418&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49418&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49418&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49418&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49418&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49418&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49418&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49418&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49418&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49418&r=mysqlcfg

« previous php.bugs (#141719) next »