|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2015-08-07 15:55 UTC] 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"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 04:00:01 2025 UTC | 
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... :<