#24926 [Ver]: a lambda function (create_function()) cannot be stored in a class property

From: Date: Sat, 29 Nov 2003 02:27:15 +0000
Subject: #24926 [Ver]: 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-51286@lists.php.net to get a copy of this message
 ID:               24926
 Updated by:       sniper@php.net
 Reported By:      kris dot hofmans at pandora dot be
 Status:           Verified
 Bug Type:         Zend Engine 2 problem
 Operating System: *
 PHP Version:      5CVS-2003-11-29
 New Comment:

Note: Works fine with PHP 4..



Previous Comments:
------------------------------------------------------------------------

[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


Thread (4 messages)

« previous php.bugs (#51286) next »