Bug #72216 [Opn->Csd]: Return by reference with finally is not memory safe

From: Date: Wed, 13 Jul 2016 12:09:05 +0000
Subject: Bug #72216 [Opn->Csd]: Return by reference with finally is not memory safe
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202276@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72216&edit=1 ID: 72216 Updated by: dmitry@php.net Reported by: nikic@php.net Summary: Return by reference with finally is not memory safe -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=3b8cb2119b33ed6b7701d78d32eed63593cf61ff Log: Fixed bug #72347 (VERIFY_RETURN type casts visible in finally) Fixed bug #72216 (Return by reference with finally is not memory safe) Fixed bug #72215 (Wrong return value if var modified in finally) Previous Comments: ------------------------------------------------------------------------ [2016-05-16 09:01:43] nikic@php.net Related To: Bug #72215 ------------------------------------------------------------------------ [2016-05-13 23:33:43] nikic@php.net Description: ------------ Test script will valgrind (and show a leak). This issue is closely related to bug #72215, in that both are caused by us not computing the final return value (and backing it up) before the finally. Test script: --------------- <?php function &test() { $a = []; try { return $a[0]; } finally { $a[""] = 42; } } var_dump(test()); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72216&edit=1

« previous php.bugs (#202276) next »