I need to be able to trigger a fatal error in PHP 7 that is not thrown as an exception.
According to the PHP docs, most of the fatal errors have been converted to exceptions. However, I can't find any docs on which ones were and were not converted.
My Question: What is something I can do in PHP to trigger one of the fatal errors that has not been converted to an exception?
Reason: I am developing a universal error handler for an API based application. I need a test case to prove it will work as I say it does.
You can trigger a fatal in a number of ways, calling an undefined function is one such way and pretty simple, e.g.
<?php
foo();
<br />
<b>Fatal error</b>: Uncaught Error: Call to undefined function foo() in [...][...]:4
Stack trace:
#0 {main}
thrown in <b>[...][...]</b> on line <b>4</b><br />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With