|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
|
The bug was updated successfully.
[2015-05-15 13:53 UTC] contact at jubianchi dot fr
Description: ------------ Today, I was playing with EngineException when I saw something that might be a bug. EngineException are throwable from userland but if we do so, and do not handle the exception, PHP exits with a status 254 and produces no output. Test script: --------------- <?php // http://3v4l.org/sLnOI throw new \EngineException('I mess everything up! :trollface:'); Expected result: ---------------- Fatal error: Uncaught exception 'EngineException' with message 'I mess everything up! :trollface:' in /in/3TbdX:5 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 07:00:01 2025 UTC |
maybe we should disallow initialize a engineException/ParserExcetpion etc in userland? Anyway, a quick fix is set type if it is zero: /* This function doesn't return if it uses E_ERROR */ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ @@ -914,6 +914,10 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ zend_long line = zval_get_long(GET_PROPERTY_SILENT(&exception, "line")); zend_long code = zval_get_long(GET_PROPERTY_SILENT(&exception, "code")); + if (UNEXPECTED(code == 0)) { + code = E_ERROR; + } + if (ce_exception == type_exception_ce && strstr(message->val, ", called in ")) { zend_error_helper(code, file->val, line, "%s and defined", message->val); } else {There seems to be a leak in the latest master as well which is visible using a debug build: [daniel@centos aerys]$ php7 -a Interactive shell php > $test = new TypeException("test"); php > throw new \RuntimeException; Warning: Uncaught exception 'RuntimeException' in php shell code:1 Stack trace: #0 {main} thrown in php shell code on line 1 php > exit [Fri May 15 13:48:52 2015] Script: '-' /home/daniel/dev/c/php-src/Zend/zend_objects.c(145) : Freeing 0xB7464280 (136 bytes), script=- === Total 1 memory leaks detected ===