|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-05-28 12:40 UTC] nikic@php.net
[2016-05-28 12:40 UTC] nikic@php.net
-Status: Open
+Status: Closed
[2016-07-20 11:30 UTC] davey@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ L6 YIELD L8 ECHO "INNER " L8 FAST_RET<TO_CATCH> ~0 try-catch(0) L10 CATCH "Exception" $e 1 and then it goes bad. When reaching the catch without an Exception, it goes to finally without fast_call u2.lineno variable being -1. [Or in master, where there's no target for the last catch, it immediately goes nuts.] Could be easily fixed by just marking the other FAST_RET's fast_call u2.lineno variables as -1, but then there is the second case when an actual exception gets thrown while in finally and caught, where this approach does not work (as there is no further opcode after a successful catch). Test script: --------------- // First example function gen() { try { try { yield; } finally { print "INNER\n"; } } catch (Exception $e) { print "EX\n"; } finally { print "OUTER\n"; } print "NOTREACHED\n"; } gen()->current(); // Second example function gen2() { try { try { yield; } finally { print "INNER\n"; throw new Exception; } } catch (Exception $e) { print "EX\n"; } print "NOTREACHED\n"; } gen2()->current(); Expected result: ---------------- // First example: INNER OUTER // Second example: INNER EX Actual result: -------------- // First example (undefined in master after OUTER step due to the last catch not having a target opline defined) INNER OUTER NOTREACHED // Second example INNER EX NOTREACHED