Bug #66608 [NEW]: Incorrect behavior with nested "finally" blocks
From: drewparoski at gmail dot com
Operating system: CentOS Linux 6.3
PHP version: 5.6.0alpha1
Package: *General Issues
Bug Type: Bug
Bug description:Incorrect behavior with nested "finally" blocks
Description:
------------
The test script I provided _should_ print out "1", "2", "3",
"4", and
"5" in order and then it should exit gracefully.
When I run the test script under PHP 5.6.0alpha1 (downloaded and built
today from http://downloads.php.net/tyrael/php-5.6.0alpha1.tar.gz),
it
prints out "1", "2", and "3", and then it gets stuck in an infinite
loop
that keeps printing out "4" over and over again. It never prints out "5"
and the php process never exits.
I can consistently reproduce this behavior on my machine. I'm running
CentOS Linux 6.3 on a 64-bit Intel Xeon processor, but I think this bug
should be easily reproducible on most other platforms and processors.
I attached gdb to the php process to investigate, and it appears that
the Zend engine is getting stuck in an infinite loop that keeps jumping
between in execute_ex(), ZEND_JMP_SPEC_HANDLER(),
ZEND_FAST_RET_SPEC_HANDLER(), and ZEND_ECHO_SPEC_CONST_HANDLER() from
"zend_vm_execute.h".
I can also reproduce this bug with various builds of PHP 5.5.0.
Test script:
---------------
<?php
function bar() {
try {
echo "1\n";
} finally {
try {
throw new Exception("");
} catch (Exception $ab) {
echo "2\n";
} finally {
echo "3\n";
}
echo "4\n";
}
echo "5\n";
}
bar();
Expected result:
----------------
1
2
3
4
5
Actual result:
--------------
1
2
3
4
4
4
4
4
4
4
4
... the php process keeps printing "4" over and over forever ...
--
Edit bug report at https://bugs.php.net/bug.php?id=66608&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66608&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66608&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66608&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66608&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66608&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66608&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66608&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66608&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66608&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66608&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66608&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66608&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66608&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66608&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66608&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66608&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66608&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66608&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66608&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66608&r=mysqlcfg
Thread (5 messages)
- drewparoski at gmail dot com