Hi internals This maybe a little bit late but I would like to propose alternative to this RFC.
What if we add `strict_errors` declare to make every function/method in files that declared `strict_errors` throw ErrorException on Notice/Warning. Example: File: Test.php <?php declare(strict_errors=1); // does not support block declare like 'strict_type' class Test { public function __construct() { echo $a; // ErrorException will be thrown from here } } File: main.php <?php require 'Test.php'; $test = new Test(); // Fatal error: Uncaught ErrorException: Undefined variable: a But if `set_error_handler()` is in use nothing will happen. File: main.php <?php require 'Test.php'; set_error_handler(function () { }); $test = new Test(); // silent I've just made a naive implementation to demonstrate this approach at https://github.com/webdevxp/php-src. What I've done was just adding new ZEND_ACC_STRICT_ERRORS flag to top level function and modified `php_error_cb` to check if there is a caller with `strict_errors` defined. (by simply checking `EG(current_execute_data)` and its all `prev_execute_data`) I think this approach might satify both 'strict camp' and 'bc camp'. P.S. I myself agree with this RFC and would vote YES if I can vote. And I'm grateful for Nikita's (and others) contributions that make PHP awesome today. Cheers :) On Wed, Aug 28, 2019 at 4:33 PM Nikita Popov <nikita....@gmail.com> wrote: > Hi internals, > > I think it's time to take a look at our existing warnings & notices in the > engine, and think about whether their current classification is still > appropriate. Error conditions like "undefined variable" only generating a > notice is really quite mind-boggling. > > I've prepared an RFC with some suggested classifications, though there's > room for bikeshedding here... > > https://wiki.php.net/rfc/engine_warnings > > Regards, > Nikita >