php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52068 more closures on script fail
Submitted: 2010-06-12 21:54 UTC Modified: 2010-06-12 22:39 UTC
From: wdolek at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.2 OS: Fedora 12, 2.6.32.11-99
Private report: No CVE-ID: None
 [2010-06-12 21:54 UTC] wdolek at gmail dot com
Description:
------------
I'm not able to use more closures on single script. Closures - assigned to variable or used as anonymous are null, instead of instance of Closure class.

Also it is really curious, sometimes it works, if there is more code before closure creation.

Fedora 12: 2.6.32.12-115.fc12.x86_64

Test script:
---------------
// * * * * * * * * * * closure 1
echo 'closure 1';
var_dump(function($arg1) {
	return intval($arg1) * 2;
});

// * * * * * * * * * * closure 2
echo 'closure 2';
$c2 = function() {
	echo time();		
};
var_dump($c2);

// * * * * * * * * * * closure 3
echo 'closure 3';
var_dump(function() {
	return sha1(strval(rand()));
});

Expected result:
----------------
closure 1

object(Closure)[1]

closure 2

object(Closure)[2]

closure 3

object(Closure)[3]


Actual result:
--------------
closure 1

null

closure 2

null

closure 3

object(Closure)[1]


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-12 22:02 UTC] felipe@php.net
I cannot reproduce it on 5.3.3-dev.

closure 1object(Closure)#1 (1) {
  ["parameter"]=>
  array(1) {
    ["$arg1"]=>
    string(10) "<required>"
  }
}
closure 2object(Closure)#1 (0) {
}
closure 3object(Closure)#2 (0) {
}
 [2010-06-12 22:02 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2010-06-12 22:02 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2010-06-12 22:38 UTC] wdolek at gmail dot com
-Status: Feedback +Status: Closed
 [2010-06-12 22:38 UTC] wdolek at gmail dot com
I have discovered that this is problem of eAccelerator 0.9.6, not problem of PHP!
 [2010-06-12 22:39 UTC] felipe@php.net
-Status: Closed +Status: Bogus
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 17:01:34 2025 UTC