php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51104 Fatal error when using Lambda function & error_reporting() in same file
Submitted: 2010-02-21 07:23 UTC Modified: 2010-02-21 08:02 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: gern_ at hotmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.1 OS: Windows 7 Pro 64bit
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: gern_ at hotmail dot com
New email:
PHP Version: OS:

 

 [2010-02-21 07:23 UTC] gern_ at hotmail dot com
Description:
------------
When calling error_reporting() before any lambda function will cause a 
Fatal Error.

Putting error_reporting() in a separate file "fix" this bug.

Reproduce code:
---------------
error_reporting(E_ALL); // uncomment this line to work

$lambda = function() { print 'Hello World'; };
$lambda();

// calling error_reporting(E_ALL) at this point will not cause Fatal Error

Expected result:
----------------
Hello World

Actual result:
--------------
Fatal error: Function name must be a string in D:\www\lambda.php on line 
6

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-21 07:42 UTC] mick1986 at hotmail dot com
I'm having similar issue on the same OS & PHP version.

$lambda = function() { print 'Hello World'; };
$lambda();
$array['test'] = 2; // this trigger a Fatal Error
 [2010-02-21 08:02 UTC] gern_ at hotmail dot com
I did a fresh install of PHP 5.3.1 and no more Fatal Error
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 17:01:34 2025 UTC