Bug #71485 [Opn->Csd]: Return typehint on interanal func causes Fatal error when it throws exception
| From: | laruence@php.net | Date: | Sat, 30 Jan 2016 06:06:13 +0000 |
| Subject: | Bug #71485 [Opn->Csd]: Return typehint on interanal func causes Fatal error when it throws exception | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198969@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71485&edit=1
ID: 71485
Updated by: laruence@php.net
Reported by: zaq178miami at gmail dot com
Summary: Return typehint on interanal func causes Fatal error
when it throws exception
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: Debian GNU/Linux 8.2 (jessie)
PHP Version: master-Git-2016-01-29 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e0627594011364e6d75d86a87c6c3a9219e704d1
Log: Fixed bug #71485 (Return typehint on interanal func causes Fatal error when it throws
exception).
Previous Comments:
------------------------------------------------------------------------
[2016-01-29 20:14:45] zaq178miami at gmail dot com
Description:
------------
In debug mode, when we define return type info as object and specify class for it, e.g.
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(test_arginfo, ZEND_RETURN_VALUE, 0, IS_OBJECT,
"ClassName", 0)
ZEND_END_ARG_INFO()
and then throw exception from function, e.g.
PHP_FUNCTION(test) {
if (zend_parse_parameters_none() == FAILURE) {
return;
}
zend_throw_exception(zend_exception_get_default(), "Test exception", 0);
}
we have fatal error "Fatal error: Return value of test() must be an instance of ClassName, null
returned in Unknown on line 0"
While allow_null set to 1 fixes this problem, it is clearly a bug, while after exception thrown,
method returned value not used, so no type check after exception should be performed (debug mode
affected only).
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71485&edit=1