php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72216 Return by reference with finally is not memory safe
Submitted: 2016-05-13 23:33 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:-1 (-100.0%)
From: nikic@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nikic@php.net
New email:
PHP Version: OS:

 

 [2016-05-13 23:33 UTC] 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());



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-13 12:09 UTC] dmitry@php.net
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)
 [2016-07-13 12:09 UTC] dmitry@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:29 UTC] davey@php.net
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)
 [2016-10-17 10:11 UTC] bwoebi@php.net
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)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC