com php-src: Closure::fromCallable(): Fix late static binding: Zend/tests/closures/closure_from_callable_lsb.phpt Ze nd/zend_closures.c
| From: | Nikita Popov | Date: | Tue, 05 Jul 2016 13:31:11 +0000 |
| Subject: | com php-src: Closure::fromCallable(): Fix late static binding: Zend/tests/closures/closure_from_callable_lsb.phpt Ze nd/zend_closures.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92802@lists.php.net to get a copy of this message | ||
Commit: e959a9b65234902acb4e25602ac05d4cd546f8a7
Author: Nikita Popov <nikic@php.net> Tue, 5 Jul 2016 15:22:13 +0200
Parents: de643ead3ec0fe256d2b71649ba7d9c84e2e2102
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e959a9b65234902acb4e25602ac05d4cd546f8a7
Log:
Closure::fromCallable(): Fix late static binding
Changed paths:
A Zend/tests/closures/closure_from_callable_lsb.phpt
M Zend/zend_closures.c
Diff:
diff --git a/Zend/tests/closures/closure_from_callable_lsb.phpt
b/Zend/tests/closures/closure_from_callable_lsb.phpt
new file mode 100644
index 0000000..bd57fba
--- /dev/null
+++ b/Zend/tests/closures/closure_from_callable_lsb.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Testing Closure::fromCallable() functionality: Late static binding
+--FILE--
+<?php
+
+class Foo {
+ const BAR = 1;
+ public static function method() {
+ return static::BAR;
+ }
+}
+var_dump(Closure::fromCallable(['Foo', 'method'])());
+
+?>
+--EXPECT--
+int(1)
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index 6185c21..ef321e7 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -297,7 +297,7 @@ static int zend_create_closure_from_callable(zval *return_value, zval *callable,
ZVAL_OBJ(&instance, fcc.object);
zend_create_fake_closure(return_value, mptr, mptr->common.scope, fcc.object->ce,
&instance);
} else {
- zend_create_fake_closure(return_value, mptr, mptr->common.scope, NULL, NULL);
+ zend_create_fake_closure(return_value, mptr, mptr->common..scope, mptr->common.scope,
NULL);
}
return SUCCESS;