Doc #61999 [NEW]: Static lambdas not documented

From: Date: Thu, 10 May 2012 18:55:01 +0000
Subject: Doc #61999 [NEW]: Static lambdas not documented
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8355@lists.php.net to get a copy of this message
From: Operating system: Any PHP version: 5.4.3 Package: Documentation problem Bug Type: Documentation Problem Bug description:Static lambdas not documented Description: ------------ Neither http://php.net/manual/en/class.closure.php nor http://www.php.net/manual/en/functions.anonymous.php mention that anonymous functions / lambdas bind the object they are defined in to $this, and that the automatic binding functionality can be avoided by declaring the lambda as static: <?php $lambda = static function() { ... } ?> There should probably be a warning about generating lambdas in object contexts as it silently binds a reference to the defining object, which could cause all sorts headaches when attempting to cause the destruction of an object. Defining a static lambda like the code sample above prevents the lambda from binding to its defining object. Please patch the documentation accordingly. Thanks! -- Edit bug report at https://bugs.php.net/bug.php?id=61999&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61999&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61999&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61999&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61999&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61999&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61999&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61999&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61999&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61999&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61999&r=support Expected behavior: https://bugs.php.net/fix.php?id=61999&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61999&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61999&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61999&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61999&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=61999&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61999&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61999&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61999&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61999&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61999&r=mysqlcfg

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