|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-04-21 10:34 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 05:00:01 2025 UTC |
Description: ------------ When using the "-r" or "-run" command-line option to execute code, a custom exception handler is not invoked. Reproduce code: --------------- $ cat command_line_exception_handler.php <? function handler($e) { print "Caught exception " . $e->getMessage() . "\n"; } set_exception_handler("handler"); throw new Exception("Hello, World!"); Expected result: ---------------- $ php command_line_exception_handler.php Caught exception Hello, World! $ php -r "require 'command_line_exception_handler.php';" Caught exception Hello, World! Actual result: -------------- $ php command_line_exception_handler.php Caught exception Hello, World! $ php -r "require 'command_line_exception_handler.php';" Fatal error: Uncaught exception 'Exception' with message 'Hello, World!' in /home/jbq/command_line_exception_handler.php:6 Stack trace: #0 Command line code(1): require() #1 {main} thrown in /home/jbq/command_line_exception_handler.php on line 6