Bug #69640 [Opn]: Unhandled EngineExceptions thrown from userland do not produce any output
| From: | contact at jubianchi dot fr | Date: | Fri, 15 May 2015 14:51:14 +0000 |
| Subject: | Bug #69640 [Opn]: Unhandled EngineExceptions thrown from userland do not produce any output | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192679@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69640&edit=1
ID: 69640
User updated by: contact at jubianchi dot fr
Reported by: contact at jubianchi dot fr
Summary: Unhandled EngineExceptions thrown from userland do
not produce any output
Status: Open
Type: Bug
Package: *General Issues
PHP Version: master-Git-2015-05-15 (Git)
Block user comment: N
Private report: N
New Comment:
> maybe we should disallow initialize a engineException/ParserExcetpion etc in userland?
I think EngineException/ParserExcetpion should not be allowed in userland code. When they are used
they can produce too much side effects, i.e a user exception handled as if it were an actual
catchable fatal error.
Previous Comments:
------------------------------------------------------------------------
[2015-05-15 14:25:14] laruence@php.net
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 {
------------------------------------------------------------------------
[2015-05-15 13:53:04] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69640&edit=1