Bug #67047 [Asn->Csd]: weird behaviour of finally()

From: Date: Fri, 14 Aug 2015 17:56:05 +0000
Subject: Bug #67047 [Asn->Csd]: weird behaviour of finally()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195212@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67047&edit=1 ID: 67047 Updated by: cmb@php.net Reported by: tony2001@php.net Summary: weird behaviour of finally() -Status: Assigned +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: * PHP Version: 5.5Git-2014-04-09 (Git) Assigned To: laruence Block user comment: N Private report: N New Comment: Obviously, this issue has been fixed as of PHP 5.6.0, see <http://3v4l.org/CifNd>. Previous Comments: ------------------------------------------------------------------------ [2014-04-09 11:00:12] laruence@php.net As we talked, this is a knew issue, which should be fixed in 5.6+, but due to ABI break, we can not bring the fix to 5.5... ------------------------------------------------------------------------ [2014-04-09 09:52:07] tony2001@php.net Description: ------------ The following code behaves unexpectedly with finally, see the reproduce code. Test script: --------------- First file: <?php spl_autoload_register(function(){ require_once "test1.php"; }); try { try { throw new \RuntimeException("ERROR"); } finally { echo "AUTOLOAD", PHP_EOL; $q = \Test::ONE; echo "YOU WON'T SEE THIS LINE", PHP_EOL; } } catch (\Exception $Error) { echo $Error->getMessage(), PHP_EOL; } ?> Second file: test1.php <?php class Test { const ONE = "ONE"; } echo \Test::ONE, PHP_EOL; Expected result: ---------------- The code in finally() is executed only partly: the lines after the autoload are ignored. I would expect the result look like this: AUTOLOAD ONE YOU WON'T SEE THIS LINE ERROR Actual result: -------------- AUTOLOAD ONE ERROR ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67047&edit=1

« previous php.bugs (#195212) next »