1) Division by zero behavior in PHP is really inconsistent.
It emits WARNING and returns FALLE.
Note, that since PHP-5.6 division by zero may also occur in constant
expressions. They are compiled and evaluated only once (on first request)
and on next request WARNING is going to be hidden.
$ cat div.php
<?php
class C {
const T = 5 / 0;
}
var_dump(C::T);
?>
$ sapi/cgi/php-cgi -q -T 3 div.php
PHP Warning: Division by zero in
/home/dmitry/php/php-master/CGI-DEBUG/div.php on line 3
bool(false)
bool(false)
bool(false)
I propose to change this into fatal error for division by zero at
compile-time and exception a run-time.
2) Very similar weird behavior was introduced for shift with negative
offsets. I also propose to change it in the same way (Fatal error at
compile-time, Exception in run-time).
Any thoughts? objections?
Thanks. Dmitry.