diff options
author | Nikita Popov <nikic@php.net> | 2015-10-09 23:28:58 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-10-09 23:28:58 +0200 |
commit | d677b25b1c5fba2451ddeedb22cad29e1cda15cb (patch) | |
tree | 797e88975bd44d831b752973f77bc9e7d9dfa81f | |
parent | f6ae19f15824104e8d90c4b364cc42e960f059fd (diff) | |
parent | e19423f3cbeaf2ac57a4af1e7c5b84fc6721177b (diff) | |
download | php-git-d677b25b1c5fba2451ddeedb22cad29e1cda15cb.tar.gz |
Merge branch 'PHP-5.6' into PHP-7.0
-rw-r--r-- | Zend/tests/bug70681.phpt | 5 | ||||
-rw-r--r-- | Zend/zend_closures.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/Zend/tests/bug70681.phpt b/Zend/tests/bug70681.phpt index a99180b0ce..9dd09b07b8 100644 --- a/Zend/tests/bug70681.phpt +++ b/Zend/tests/bug70681.phpt @@ -6,6 +6,11 @@ Bug #70681: Segfault when binding $this of internal instance method to null $c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack); $c = $c->bindTo(null); +$c = (new ReflectionFunction('strlen'))->getClosure(); +$c = $c->bindTo(null); +var_dump($c("foo")); + ?> --EXPECTF-- Warning: Cannot unbind $this of internal method in %s on line %d +int(3) diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 6631193e13..0ac4cc5e48 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -174,7 +174,7 @@ ZEND_METHOD(Closure, bind) } if (newthis == NULL && !(closure->func.common.fn_flags & ZEND_ACC_STATIC) - && closure->func.type == ZEND_INTERNAL_FUNCTION) { + && closure->func.common.scope && closure->func.type == ZEND_INTERNAL_FUNCTION) { zend_error(E_WARNING, "Cannot unbind $this of internal method"); return; } |