On Sat, May 16, 2015 at 2:17 PM, Rowan Collins <rowan.coll...@gmail.com> wrote: > On 16/05/2015 20:15, Levi Morrison wrote: >> >> The difference is that as time goes on and I've written code for PHP 7 >> I was hit by this issue. It's an even bigger issue than even I >> realized during voting. How many people who voted on that issue have >> played with the code from both scenarios? Few, I can't guarantee it >> but given the historical precedent it's almost certainly true. > > > Can you give an example of the issue you were hit with? A sample program / > scenario, where failure to catch an EngineException caused behaviour that > was in some way worse than that under PHP 5?
Here's a simplified example that illustrates one issue: <?php set_error_handler(function(){ echo "Handled."; }); function foo(callable $f) {} try { foo("bar is not callable"); } catch (Exception $e) { echo "Caught."; } echo "Done.", PHP_EOL; ?> In PHP 5 this prints "Handled.Done". Under PHP 7 this fails with: > Fatal error: Argument 1 passed to foo() must be callable, string given Note that if the TypeException had been caught by catch (Exception $e) the program would have still been correct. This kind of setup exists in PHPUnit for example; even if the test has some bad syntax or failure the testing harness needs to continue. There are other valid uses as well. The only way to make this work in both PHP 5 and 7 is to modify the code, despite the program being 100% correct under PHP 5 and the documented semantics. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php