Bug #69957 [Csd->ReO]: Three different ways of handling same error condition

From: Date: Sat, 04 Jul 2015 23:00:29 +0000
Subject: Bug #69957 [Csd->ReO]: Three different ways of handling same error condition
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194122@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69957&edit=1 ID: 69957 Updated by: googleguy@php.net Reported by: cameron dot adam+php at gmail dot com Summary: Three different ways of handling same error condition -Status: Closed +Status: Re-Opened Type: Bug Package: Scripting Engine problem Operating System: Windows 7 64-bit PHP Version: 7.0.0alpha2 Assigned To: bwoebi Block user comment: N Private report: N New Comment: This issue has been reopen due to ongoing discussion in the mailing list (see http://news.php.net/php.internals/87016) How you chose to handle a division by zero error in your code (in floating point arithmetic) shouldn't be dictated by whether or not PHP throws an exception, since exception handling is not the only way to handle errors in a program, nor is this exceptional in PHP since with a/0 returning INF per IEE754, we have well defined behavior. However, removing the warning removes useful error information the programmer could otherwise use to debug potentially buggy code. So the E_WARNING should be brought back and all other behavior remain the same. Previous Comments: ------------------------------------------------------------------------ [2015-07-02 19:21:48] bwoebi@php.net Okay, now fixed for real via http://git.php.net/?p=php-src.git;a=commitdiff;h=f9724b93f6592d2f77fa9165038a0ba0db3da0c6 http://git.php.net/?p=php-src.git;a=commitdiff;h=007d7ac7ca6d52ba5e7a0ba7b2c582a04ddc50df http://git.php.net/?p=php-src.git;a=commitdiff;h=94722e12cf4ba9a16f8a9f009d60b2e3f0f80e12 Warning was removed completely for division by zero. DivisionByZeroError extends ArtithmeticError extends Error introduced for mod and intdiv. ------------------------------------------------------------------------ [2015-06-29 13:26:35] bwoebi@php.net Hmm, okay. I noticed that mod_function didn't throw in 5.6. I though the division was accidentally missed out. Sorry for the bad communication; I totally didn't recall that it was discussed before. ------------------------------------------------------------------------ [2015-06-29 10:32:10] cameron dot adam+php at gmail dot com Yeah, got that. My point was not that your not fulfilling the prescribed behaviour, it's that the behaviour you're prescribing lacks uniformity, and - in the bigger scheme of things - isn't terribly sensible or helpful. The article I link to in the original ticket details this: I did not want to duplicate it here for various reasons. Cheers. ------------------------------------------------------------------------ [2015-06-29 10:24:44] dmitry@php.net The patch was reverted. Division by zero doesn't throw exception on purpose. It emits warning and returns INF. ------------------------------------------------------------------------ [2015-06-29 09:18:47] ab@php.net Hi Bob, this breaks the discussed behaviors and should be reverted. See the intdiv RFC and http://www.serverphorums.com/read.php?7,1174854 . I guess to fix this the correct behavior needs to be discussed and defined. Thanks. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=69957 -- Edit this bug report at https://bugs.php.net/bug.php?id=69957&edit=1

« previous php.bugs (#194122) next »