Browse Source

Fixed bug #45608 (closures don't work in static methods)

experimental/first_unicode_implementation
Dmitry Stogov 18 years ago
parent
commit
2d49dc63e6
  1. 14
      Zend/tests/closure_023.phpt
  2. 1
      Zend/zend_closures.c

14
Zend/tests/closure_023.phpt

@ -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

1
Zend/zend_closures.c

@ -305,6 +305,7 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
closure->this_ptr = this_ptr;
Z_ADDREF_P(this_ptr);
} else {
closure->func.common.fn_flags |= ZEND_ACC_STATIC;
closure->this_ptr = NULL;
}
} else {

Loading…
Cancel
Save