#41380 [NEW]: Unable to store lambda-style functions in object properties.

From: Date: Sat, 12 May 2007 20:51:28 +0000
Subject: #41380 [NEW]: Unable to store lambda-style functions in object properties.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112589@lists.php.net to get a copy of this message
From: stosh1985 at gmail dot com Operating system: Mac OS X PHP version: 5.2.2 PHP Bug Type: Scripting Engine problem Bug description: Unable to store lambda-style functions in object properties. Description: ------------ I am unable to store lambda-style function within object properties, like I am with normal variables. The below code does not work, neither does calling $this->$method() or using call_user_func() with passing in array($this, $this->method) for the callback. Reproduce code: --------------- <?php class foo { public $method; function __construct() { $this->method = create_function('$a, $b', 'print $a . "\n" . $b . "\n\n"; '); $this->method('a', 'b'); } } $x = new foo(); $x->method('a', 'b'); ?> Expected result: ---------------- a b a b Actual result: -------------- Fatal error: Call to undefined method foo::method -- Edit bug report at http://bugs.php.net/?id=41380&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41380&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41380&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41380&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41380&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41380&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41380&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41380&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41380&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41380&r=support Expected behavior: http://bugs.php.net/fix.php?id=41380&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41380&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41380&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41380&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41380&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41380&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41380&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41380&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41380&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41380&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41380&r=mysqlcfg

« previous php.bugs (#112589) next »