Edit report at https://bugs.php.net/bug.php?id=65326&edit=1
ID: 65326 Updated by: yohg...@php.net Reported by: yuri dot kanivetsky at gmail dot com Summary: set_exception_handler and requiring non-existent file -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: linux, windows PHP Version: 5.4.17 Block user comment: N Private report: N New Comment: Since you are requiring non existent file with "require", it stops execution due to E_ERROR. Try it with "include", it should work. Previous Comments: ------------------------------------------------------------------------ [2013-07-24 14:55:56] yuri dot kanivetsky at gmail dot com Description: ------------ My code converts errors to exceptions, but it turned out that when faced with "Failed opening required 'whatever'" error, exception handler doesn't get called. More precisely, it doesn't work for require, but works for include. I tested it on debian 6.0.6 (php-5.4.15), on arch linux (php-5.4.17) and on windows 7 (php-5.4.17). Test script: --------------- #!/usr/bin/env php <?php set_error_handler(function() { echo "error\n"; throw new Exception; }); set_exception_handler(function() { echo "exception\n"; }); require 'asdf'; Expected result: ---------------- error exception Actual result: -------------- error PHP Warning: Uncaught exception 'Exception' in /home/yuri/1.php:6 Stack trace: #0 /home/yuri/1.php(11): {closure}(2, 'require(asdf): ...', '/home/yuri/1.ph...', 11, Array) #1 /home/yuri/1.php(11): require() #2 {main} thrown in /home/yuri/1.php on line 6 PHP Fatal error: main(): Failed opening required 'asdf' (include_path='.:/usr/share/php:/usr/share/pear') in /home/yuri/1.php on line 11 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65326&edit=1