|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-09-15 09:28 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 20:00:01 2025 UTC |
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 ]