Bug #65665 [Com]: Exception not properly caught when opcache enabled
Edit report at https://bugs.php.net/bug.php?id=65665&edit=1
ID: 65665
Comment by: jpauli@php.net
Reported by: ryan dot brothers at gmail dot com
Summary: Exception not properly caught when opcache enabled
Status: Open
Type: Bug
Package: opcache
Operating System: Linux
PHP Version: 5.5.3
Block user comment: N
Private report: N
New Comment:
This is an optimizer bug.
If you run with opcache.optimization_level=0 , the bug disappears.
I guess the bug is in the optimizer pass that handles ZEND_CATCH.
PS : I reproduced with a 5.4 base.
Previous Comments:
------------------------------------------------------------------------
[2013-09-13 00:15:06] ryan dot brothers at gmail dot com
Description:
------------
When running the following script with opcache enabled, the exception is not caught by the correct
catch block. The exception should be caught by the 'caught by 1' block, but it is instead
caught by the 'caught by 2' block. Disabling opcache causes the exception to be caught in
the correct block.
Run the script with:
php -n -d zend_extension=opcache.so -d opcache.enable_cli=1 script.php
Test script:
---------------
<?php
try
{
switch (1)
{
case 0:
try
{
}
catch (Exception $e)
{
}
break;
case 1:
try
{
throw new Exception('aaa');
}
catch (Exception $e)
{
echo 'caught by 1';
exit;
}
break;
}
}
catch (Exception $e)
{
echo 'caught by 2';
exit;
}
Expected result:
----------------
caught by 1
Actual result:
--------------
caught by 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65665&edit=1
Thread (7 messages)