Bug #72188 [NEW]: Nested try/finally blocks losing return value
| From: | lee at saferite dot com | Date: | Tue, 10 May 2016 19:11:06 +0000 |
| Subject: | Bug #72188 [NEW]: Nested try/finally blocks losing return value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200997@lists.php.net to get a copy of this message | ||
From: lee at saferite dot com
Operating system: Ubuntu 14.04
PHP version: 7.0.6
Package: Unknown/Other Function
Bug Type: Bug
Bug description:Nested try/finally blocks losing return value
Description:
------------
When you next a try/finally inside of a finally block it causes the
return value from the outer try block to be lost.
Test script:
---------------
<?php
function test() {
try {
return 5;
} finally {
try {
// NOOP
} finally {
// NOOP
}
}
}
$a = test();
if($a !== 5) {
echo "FAILED: expected 5, received ", var_export($a), PHP_EOL;
} else {
echo "Passed", PHP_EOL;
}
Expected result:
----------------
The call to test() should be seeing an int value of 5.
Actual result:
--------------
5.5.16-5.6.21 -- Works as expected
5.5.0-5.5.15 -- Exit code of 137 (SIGKILL)
7.0.0-7.0.6 -- The outer return value is lost and a null is returned.
--
Edit bug report at https://bugs.php.net/bug.php?id=72188&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72188&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72188&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72188&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72188&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72188&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72188&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72188&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72188&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72188&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72188&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72188&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72188&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72188&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72188&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72188&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72188&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72188&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72188&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72188&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72188&r=mysqlcfg