Doc #71348 [NEW]: Static anonymous functions are not documented

From: Date: Tue, 12 Jan 2016 10:54:22 +0000
Subject: Doc #71348 [NEW]: Static anonymous functions are not documented
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13089@lists.php.net to get a copy of this message
From: korikulum at net dot hr Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:Static anonymous functions are not documented Description: ------------ --- From manual page: http://www.php.net/functions.anonymous --- Since PHP 5.4 anonymous function can be declared statically (https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#anonymous-function-creation). When an anonymous function is declared statically, it prevents auto-binding to the instance it is in. Also, it can not be bound using the bind, bindTo & call functions. Test script: --------------- class Foo { public function bar() { return static function () { var_dump($this); }; } public function baz() { return function () { var_dump($this); }; } } $foo = new Foo(); $bar = $foo->bar(); $bar(); // Notice: Undefined variable: this // NULL $baz = $foo->baz(); $baz(); // object(Foo)#1 (0) { // } Closure::bind($bar, new StdClass()); $bar->bindTo(new StdClass()); $bar->call(new StdClass()); // Warning: Cannot bind an instance to a static closure -- Edit bug report at https://bugs.php.net/bug.php?id=71348&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71348&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71348&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71348&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71348&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71348&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71348&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71348&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71348&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71348&r=support Expected behavior: https://bugs.php.net/fix.php?id=71348&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71348&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71348&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71348&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71348&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71348&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71348&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71348&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71348&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71348&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71348&r=mysqlcfg

« previous php.doc.bugs (#13089) next »