Bug #71485 [NEW]: Return typehint on interanal func causes Fatal error when it throws exception
| From: | zaq178miami at gmail dot com | Date: | Fri, 29 Jan 2016 20:14:46 +0000 |
| Subject: | Bug #71485 [NEW]: Return typehint on interanal func causes Fatal error when it throws exception | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-198964@lists.php.net to get a copy of this message | ||
From: zaq178miami at gmail dot com
Operating system: Debian GNU/Linux 8.2 (jessie)
PHP version: master-Git-2016-01-29 (Git)
Package: *General Issues
Bug Type: Bug
Bug description:Return typehint on interanal func causes Fatal error when it throws exception
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 bug report at https://bugs.php.net/bug.php?id=71485&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71485&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71485&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71485&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71485&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71485&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71485&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71485&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71485&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71485&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71485&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71485&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71485&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71485&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71485&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71485&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71485&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71485&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71485&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71485&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71485&r=mysqlcfg