Req #72089 [Opn->Csd]: handle all fatal errors with try catch

From: Date: Tue, 26 Apr 2016 17:50:30 +0000
Subject: Req #72089 [Opn->Csd]: handle all fatal errors with try catch
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200786@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72089&edit=1 ID: 72089 Updated by: cmb@php.net Reported by: paulobitfranca at gmail dot com Summary: handle all fatal errors with try catch -Status: Open +Status: Closed Type: Feature/Change Request Package: *General Issues Operating System: Linux PHP Version: 7.0.5 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Generally, that has already been done for PHP 7.0.0 where reasonable and possible, see <https://wiki.php.net/rfc/engine_exceptions_for_php7>. With regard to your example: if a file is *required* and it can't be included, it doesn't make much sense to go on. If on the other hand the file is not really required, just include it. Previous Comments: ------------------------------------------------------------------------ [2016-04-23 21:28:00] paulobitfranca at gmail dot com Description: ------------ I mind that some fatal errors are not handled by the try/catch yet. For example, when I use require() and the include file doesn't exist. Is it possible that in a future version, all the fatal erros can be handled by try/catch? Test script: --------------- <?php error_reporting(E_ALL); try { require("xxx.php"); } catch (Throwable $e) { echo "An error: file doesn't exist" } echo "hi!"; Expected result: ---------------- An error: file doesn't exist Hi! Actual result: -------------- Fatal error: require() [function.require.html: Failed opening required 'xxx.php' (include_path='.:/opt/php7/includes') in /var/www/html/teste.php on line 8 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72089&edit=1

« previous php.bugs (#200786) next »