Bug #70207 [Opn]: Finally breaks with opcache

From: Date: Sat, 08 Aug 2015 03:41:30 +0000
Subject: Bug #70207 [Opn]: Finally breaks with opcache
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195013@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:         laruence@php.net
 Reported by:        james dot h dot cracknell at gmail dot com
 Summary:            Finally breaks with opcache
 Status:             Open
 Type:               Bug
 Package:            opcache
 Operating System:   Windows Server 2008R2
 PHP Version:        7.0.0beta3
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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 (#195013) next »