#34507 [Opn->Csd]: Divide by zero error messages during parsing
| From: | sniper@php.net | Date: | Thu, 15 Sep 2005 07:28:54 +0000 |
| Subject: | #34507 [Opn->Csd]: Divide by zero error messages during parsing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85069@lists.php.net to get a copy of this message | ||
ID: 34507
Updated by: sniper@php.net
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