ID: 34507
Updated by: [EMAIL PROTECTED]
Reported By: levi at alliancesoftware dot com dot au
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
PHP Version: 5.0.5
New Comment:
Seems to be fixed in PHP 5.1-dev.
Previous Comments:
------------------------------------------------------------------------
[2005-09-15 05:28:00] levi at alliancesoftware dot com dot au
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 this bug report at http://bugs.php.net/?id=34507&edit=1