#24926 [Ver->Csd]: a lambda function (create_function()) cannot be stored in a class property
| From: | helly@php.net | Date: | Sat, 27 Dec 2003 16:33:56 +0000 |
| Subject: | #24926 [Ver->Csd]: a lambda function (create_function()) cannot be stored in a class property | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-52523@lists.php.net to get a copy of this message | ||
ID: 24926
Updated by: helly@php.net
Reported By: kris dot hofmans at pandora dot be
-Status: Verified
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5CVS-2003-11-29
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Btw: Your code example is wrong because you declared the class bleh
twice. Also you cannot call a non method with $this.
Previous Comments:
------------------------------------------------------------------------
[2003-11-28 21:27:15] sniper@php.net
Note: Works fine with PHP 4..
------------------------------------------------------------------------
[2003-08-03 16:37:13] kris dot hofmans at pandora dot be
Description:
------------
As soon as a lamba function created by create_function gets stored in a
class property it cannot be called anymore.
Errors while trying:
Warning: call_user_func(bleh::): First argument is expected to be a
valid callback in /home/blacky/public_html/php5-dev/callback-test.php
on line 66
And
Fatal error: Call to a member function test() on a non-object in
/home/blacky/public_html/php5-dev/callback-test.php on line 36
with test being my defined function.
The closest bug report I could find resembling this problem is:
http://bugs.php.net/bug.php?id=21909
Reproduce code:
---------------
http://bbox.homelinux.net:4000/~blacky/php5-dev/callback-test.phps
Expected result:
----------------
I'd like to store functions in a property, preferably an array and call
them like
$this->property[$index]($arg1, $arg2);
Actual result:
--------------
Warning: call_user_func(bleh::): First argument is expected to be a
valid callback in /home/blacky/public_html/php5-dev/callback-test.php
on line 66
Or
Fatal error: Call to a member function test() on a non-object in
/home/blacky/public_html/php5-dev/callback-test.php on line 36
I'd expected both cases to work, first one being more logical.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24926&edit=1