From: levi at alliancesoftware dot com dot au Operating system: PHP version: 5.0.5 PHP Bug Type: Scripting Engine problem Bug description: Divide by zero error messages during parsing
Description: ------------ If you have a divide by zero constant, the initial syntax check parsing catches it as an error even if the code is never executed. A consequence of this is that error_reporting() and set_ini('display_errors'..) are ignored since the error is triggeed before the php code is exectued. This in itself is not neccessarily a bug since you shouldn't have a constant divide by zero, but the error report doesn't tell you the file it came from (says unknown at line 0): this can be very frustrating if you have a large number of include() files). Setting display_error=0 in the .ini file is also ignored if error_reporting is on Reproduce code: --------------- #!/usr/local/bin/php <? if (0) $x = 5 / 0; ?> Expected result: ---------------- File runs or, if (error_reporting | E_WARNING) && display_errors PHP Warning: Division by zero in test.php on line 3 Actual result: -------------- if (error_reporting | E_WARNING) and display_errors==0 [stderr:] PHP Warning: Division by zero in Unknown on line 0 if (error_reporting | E_WARNING) and display_errors==1 [stderr:] PHP Warning: Division by zero in Unknown on line 0 [stdout:] <br /> <b>Warning</b>: Division by zero in <b>Unknown</b> on line <b>0</b><br /> [ yes, the error is reported twice ] if (error_reporting == 0) [ No output ] -- Edit bug report at http://bugs.php.net/?id=34507&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34507&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34507&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34507&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34507&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34507&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34507&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34507&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34507&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34507&r=support Expected behavior: http://bugs.php.net/fix.php?id=34507&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34507&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34507&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34507&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34507&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34507&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34507&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34507&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34507&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34507&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34507&r=mysqlcfg