Bug #51757 [Opn->Bgs]: Division By Zero triggers Warning instead of Fatal Error

From: Date: Mon, 10 May 2010 10:20:54 +0000
Subject: Bug #51757 [Opn->Bgs]: Division By Zero triggers Warning instead of Fatal Error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-150304@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51757&edit=1

 ID:               51757
 Updated by:       aharvey@php.net
 Reported by:      sstratton@php.net
 Summary:          Division By Zero triggers Warning instead of Fatal
                   Error
-Status:           Open
+Status:           Bogus
 Type:             Bug
 Package:          Math related
 Operating System: Linux
 PHP Version:      5.3.2

 New Comment:

Division by zero generating a warning rather than an error has been
PHP's behaviour since at least April 1999, per a couple of minutes with
svn blame/log. I don't see much chance that we'd want to break backward
compatibility on that now.


Previous Comments:
------------------------------------------------------------------------
[2010-05-06 16:23:42] sstratton@php.net

Changed title to reflect scope of the bug.

------------------------------------------------------------------------
[2010-05-06 16:14:09] sstratton@php.net

Description:
------------
In PHP 5.3 (and probably 5.2x as well) a division by Zero returns null
and 
squelches a warning.  The issue becomes when the return is cast to Int
as is done 
via soap service which is where I discovered this issue.

Test script:
---------------
<?PHP
$val = 5/0;
echo (int)$val;

Expected result:
----------------
Fatal Error: Division by zero in /var/www/reproduction/test.php on line
3

Actual result:
--------------
Warning: Division by zero in /var/www/reproduction/test.php on line 3
int(0)


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51757&edit=1


Thread (3 messages)

« previous php.bugs (#150304) next »