Bug #74444 [Opn->Csd]: multiple catch freezes in some cases
| From: | nikic@php.net | Date: | Fri, 14 Apr 2017 23:41:15 +0000 |
| Subject: | Bug #74444 [Opn->Csd]: multiple catch freezes in some cases | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208575@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74444&edit=1
ID: 74444
Updated by: nikic@php.net
Reported by: matej21 at matej21 dot cz
Summary: multiple catch freezes in some cases
-Status: Open
+Status: Closed
Type: Bug
Package: Scripting Engine problem
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of matej21@matej21.cz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2135b057ec33bb480a10f642a3e42ba10364b81e
Log: Fixed bug #74444: multiple catch freezes in some cases
Previous Comments:
------------------------------------------------------------------------
[2017-04-14 22:28:52] matej21 at matej21 dot cz
I've prepared a fix https://github.com/php/php-src/pull/2481
------------------------------------------------------------------------
[2017-04-14 19:19:37] matej21 at matej21 dot cz
php -d opcache.opt_debug_level=0x10000 output is more clear than phpdbg (in which extended value is
missing)
L59: V1 = NEW 0 string("RuntimeException")
L60: DO_FCALL
L61: THROW V1
L62: JMP L67
L63: CATCH string("FooEx") CV0($e) L0
L64: JMP L66
L65: CATCH string("RuntimeException") CV0($e)
L66: ECHO int(1)
L67: RETURN null
vs one more opcode
L60: V1 = NEW 0 string("RuntimeException")
L61: DO_FCALL
L62: THROW V1
L63: JMP L68
L64: CATCH string("FooEx") CV0($e) L66
L65: JMP L67
L66: CATCH string("RuntimeException") CV0($e)
L67: ECHO int(1)
L68: RETURN null
see L0 vs L66
btw, it also fails when CATCH string("FooEx") CV0($e) is on line 255 or 1023
------------------------------------------------------------------------
[2017-04-14 18:07:11] matej21 at matej21 dot cz
Description:
------------
if there is exact number of opcodes before multi-catch, php freezes. adding or removing just one
opcode fixes the issue.
relevant oplines:
L64 #58 ECHO ""
L67 #59 NEW "RuntimeException" @0
L67 #60 DO_FCALL
L67 #61 THROW @0
L67 #62 JMP J67
L68 #63 CATCH "FooEx" $e 0
L68 #64 JMP J66
L68 #65 CATCH "RuntimeException" $e 1
L69 #66 ECHO 1
L71 #67 RETURN null
Test script:
---------------
<?php
function doSth()
{
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
try {
throw new \RuntimeException();
} catch (\FooEx | \RuntimeException $e) {
echo 1;
}
}
doSth();
Expected result:
----------------
1
Actual result:
--------------
php freezes
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74444&edit=1