#45525 [Asn->Csd]: Object Closure as
| From: | dmitry@php.net | Date: | Thu, 17 Jul 2008 09:55:34 +0000 |
| Subject: | #45525 [Asn->Csd]: Object Closure as | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126879@lists.php.net to get a copy of this message | ||
ID: 45525
Updated by: dmitry@php.net
Reported By: david at grudl dot com
-Status: Assigned
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: windows xp
PHP Version: 5.3CVS-2008-07-16 (snap)
Assigned To: dmitry
New Comment:
This bug has been fixed in CVS.
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/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-07-16 07:23:52] derick@php.net
Dmitry, could you have a look please?
------------------------------------------------------------------------
[2008-07-16 05:25:38] david at grudl dot com
Description:
------------
Lambda functions and closures are AWESOME!
But they are not still supported as ob_start() argument.
Reproduce code:
---------------
function redirect($file)
{
$handle = fopen($file, 'w');
ob_start(function($buffer) use ($handle) {
fwrite($handle, $buffer);
});
}
redirect('output.html');
echo 'Hello World!';
Expected result:
----------------
Should work
Actual result:
--------------
Fatal error: ob_start(): No method name given: use
ob_start(array($object,'method')) to specify instance $object and the
name of a method of class Closure to use as output buffer.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45525&edit=1