php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66983 anonymous function
Submitted: 2014-03-30 18:11 UTC Modified: 2015-03-22 04:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: koushky at gmail dot com Assigned:
Status: No Feedback Package: Variables related
PHP Version: 5.4.26 OS: linux x86_64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
28 - 5 = ?
Subscribe to this entry?

 
 [2014-03-30 18:11 UTC] koushky at gmail dot com
Description:
------------
i use anonymous function in other function when there is array union operator (+) above of this anonymous then the variable convert to NULL .

Test script:
---------------
class foo {
  public function test($o = array()){
    $o += array('test');
    $func = function(){};
    var_dump($func);
  }
}
$foo = new foo;
$foo->test();

Expected result:
----------------
object(Closure)#2 (1) {
  ["this"]=>
  object(x)#1 (0) {
  }
}

Actual result:
--------------
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-10 21:11 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2015-03-10 21:11 UTC] nikic@php.net
I can't reproduce this behavior on any PHP version: http://3v4l.org/rXeKq Valgrind didn't produce any output either.
 [2015-03-22 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 07:01:29 2024 UTC