Bug #70207 [Asn->Csd]: Finally breaks with opcache

From: Date: Mon, 10 Aug 2015 13:39:21 +0000
Subject: Bug #70207 [Asn->Csd]: Finally breaks with opcache
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195087@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70207&edit=1

 ID:                 70207
 Updated by:         dmitry@php.net
 Reported by:        james dot h dot cracknell at gmail dot com
 Summary:            Finally breaks with opcache
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            opcache
 Operating System:   Windows Server 2008R2
 PHP Version:        7.0.0beta3
 Assigned To:        laruence
 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=18fb424befc5c7e98b91a570752fe6e90a09b330
Log: Fixed bug #70207 (Finally is broken with opcache)


Previous Comments:
------------------------------------------------------------------------
[2015-08-08 03:41:30] laruence@php.net

a simple fix could be : https://gist.github.com/laruence/c18e97cc85f53e0200c0

------------------------------------------------------------------------
[2015-08-08 02:49:21] laruence@php.net

a little more simple reproduce case is :

<?php

function foo() {
    try { return chr(0) . "bar"; }
    finally { @fclose(null); }
}

var_dump(foo());
?>

this is because the new finally's fastcall/fastret layout finish the temp var liveness
prematurely... :<

------------------------------------------------------------------------
[2015-08-07 15:55:49] james dot h dot cracknell at gmail dot com

Description:
------------
I am seeing some very unusual results using opcache with a try block returning the result of a
method call with a finally block containing @.

    <?php
    
    function bar() { return 'bar'; }

    function foo() {
      try { return bar(); }
      finally { @fclose(null); }
    }

    var_dump(foo());

opcache, @:
===========
int(22527)

!opcache, @:
============
string(3) "bar"

opcache, !@:
============
Warning: fclose() expects parameter 1 to be resource, null given
bool(false)

!opcache, !@:
=============
Warning: fclose() expects parameter 1 to be resource, null given
string(3) "bar"



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70207&edit=1


Thread (4 messages)

« previous php.bugs (#195087) next »