cvs: ZendEngine2 / zend_closures.c /tests closure_023.phpt

"Dmitry Stogov" <[email protected]>
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsdmitry1217081744@cvsserver>
dmitry		Sat Jul 26 14:15:44 2008 UTC

  Modified files:              
    /ZendEngine2	zend_closures.c 
    /ZendEngine2/tests	closure_023.phpt 
  Log:
  Fixed bug #45608 (closures don't work in static methods)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_closures.c?r1=1.8&r2=1.9&diff_format=u
Index: ZendEngine2/zend_closures.c
diff -u ZendEngine2/zend_closures.c:1.8 ZendEngine2/zend_closures.c:1.9
--- ZendEngine2/zend_closures.c:1.8	Sat Jul 26 13:14:55 2008
+++ ZendEngine2/zend_closures.c	Sat Jul 26 14:15:44 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_closures.c,v 1.8 2008/07/26 13:14:55 dmitry Exp $ */
+/* $Id: zend_closures.c,v 1.9 2008/07/26 14:15:44 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_API.h"
@@ -305,6 +305,7 @@
 			closure->this_ptr = this_ptr;
 			Z_ADDREF_P(this_ptr);
 		} else {
+			closure->func.common.fn_flags |= ZEND_ACC_STATIC;
 			closure->this_ptr = NULL;
 		}
 	} else {
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/closure_023.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/closure_023.phpt
diff -u /dev/null ZendEngine2/tests/closure_023.phpt:1.2
--- /dev/null	Sat Jul 26 14:15:44 2008
+++ ZendEngine2/tests/closure_023.phpt	Sat Jul 26 14:15:44 2008
@@ -0,0 +1,14 @@
+--TEST--
+Closure 023: Closure declared in statically called method
+--FILE--
+<?php
+class foo {
+    public static function bar() {
+        $func = function() { echo "Done"; };
+        $func();
+    }
+}
+foo::bar();
+--EXPECT--
+Done
+



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.