Linked Questions
115 questions linked to/from How do I catch a PHP fatal (`E_ERROR`) error?
1
vote
2
answers
2k
views
is it possible to catch fatal error php on include file? [duplicate]
Here's what I want to do just if a fatal error is in the file I don't want the script to halt execution
try {
require "somethin.php"
} catch(...) {}
Would some method of file_get_contents() and ...
3
votes
2
answers
3k
views
Is there a way to catch Fatal error in PHP? [duplicate]
Possible Duplicate:
How do I catch a PHP Fatal Error
I have this line of PHP code:
thisFunctionDoesNotExist();
And it stops script execution with:
Fatal error: Call to undefined function
I ...
0
votes
3
answers
1k
views
Providing a callee response to a "call to undefined method" error? [duplicate]
I'm learning my way into some more advanced programming with PHP.
I've seen that calling an non-existent method produces "call to undefined method" error.
PHP being quite flexible is there a ...
1
vote
1
answer
931
views
Catch the PHP private __constructor fatal error and throw an exception PHP? [duplicate]
I would like to ask if this is possible:
I have a class with a private constructor which of course throws a fatal error if I try to instantiate that class from an invalid context (outside the class), ...
0
votes
1
answer
334
views
How to catch syntax errors in included files in PHP? [duplicate]
I'm developing a plugin system, which of course needs to include the plugin files. So far everything works very well - exceptions get catched etc.
But my very last wish would be to even be safe from ...
1
vote
1
answer
210
views
PHP ignores custom error handler [duplicate]
Possible Duplicate:
How do I catch a PHP Fatal Error
I want to create a custom error handler but PHP ignores it still uses the built in error handler. The example below gives a built in fatal ...
0
votes
1
answer
366
views
PHP 7.4 unable to catch Fatal error: Cannot redeclare <function> [duplicate]
I loved the introduction of the \Throwable interface and the ability to convert legacy Errors warnings and notices into catchable errors.
This is how I have rolled ever since:
//convert errors to ...
1
vote
0
answers
138
views
How to catch the Fatal Error in PHP? [duplicate]
I'm facing with the Fatal error: Maximum execution time of 30 seconds exceeded.
I'm trying to catch this error and show the error message to user but it seems that "try...catch..." in PHP can't ...
0
votes
1
answer
114
views
How to produce proper json error response for php fatal error in Laravel 8+ [duplicate]
I need to produce some proper custom error response in json format when I receive php fatal error instead of standard 500 in Laravel 8+.
How can I achieve the this outcome.
0
votes
0
answers
60
views
How to add a 'Content-Type' header to an HTTP response with PHP fatal error in IIS? [duplicate]
I use a stack of technologies Windows 10, web server IIS 10, RDBMS 'MySQL' 8.0, PHP 8.1.10.
My question was considered a duplicate of the following question: 'Trouble with UTF-8 characters; what I ...
1
vote
0
answers
50
views
Errors not being caught by "try" block [duplicate]
I was expecting this page to render as the string "TryErrorFinally", but the result is just the string "Try". Do I need to do something else to see the exception generated by calling the non-existent ...
1
vote
0
answers
43
views
How to customize some default PHP error message thrown to user [duplicate]
I encounter the situation as follows:
My system sometimes gets default two specific errors and display to user's screen. But now, my users would like to display these kind of error messages in a ...
0
votes
0
answers
28
views
Get /print fatal error message in PHP [duplicate]
How can I retrieve the message-only from a fatal error message in php store it as a variable.
I'm running a script which I believe has some custom error reporting on it when it runs. When the ...
84
votes
8
answers
93k
views
How to catch the fatal error: Maximum execution time of 30 seconds exceeded in PHP
I've been playing around with a system I'm developing and managed to get it to cause this:
Fatal error: Maximum execution time of 30 seconds exceeded
It happened when I was doing something ...
73
votes
10
answers
82k
views
How can I get php to return 500 upon encountering a fatal exception?
PHP fatal errors come back as status code 200 to the HTTP client. How can I make it return a status code 500 (Internal server error)?