diff options
author | Nikita Popov <nikic@php.net> | 2015-10-09 23:05:49 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-10-09 23:06:32 +0200 |
commit | f6ae19f15824104e8d90c4b364cc42e960f059fd (patch) | |
tree | 48248f5c2937b0594960dde41df15d261e313609 | |
parent | be09d1c262aa840658aebc0e622fbd1f62d0c12d (diff) | |
parent | bbae7ddf29192af25a3a776dfc52508c162d2ea6 (diff) | |
download | php-git-f6ae19f15824104e8d90c4b364cc42e960f059fd.tar.gz |
Merge branch 'PHP-5.6' into PHP-7.0
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | Zend/tests/bug70681.phpt | 11 | ||||
-rw-r--r-- | Zend/zend_closures.c | 6 |
3 files changed, 19 insertions, 0 deletions
@@ -7,6 +7,8 @@ PHP NEWS getClosure()). (Dmitry, Bob) . Fixed bug #70662 (Duplicate array key via undefined index error handler). (Nikita) + . Fixed buf #70681 (Segfault when binding $this of internal instance method + to null). (Nikita) - Mcrypt: . Fixed bug #70625 (mcrypt_encrypt() won't return data when no IV was diff --git a/Zend/tests/bug70681.phpt b/Zend/tests/bug70681.phpt new file mode 100644 index 0000000000..a99180b0ce --- /dev/null +++ b/Zend/tests/bug70681.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #70681: Segfault when binding $this of internal instance method to null +--FILE-- +<?php + +$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack); +$c = $c->bindTo(null); + +?> +--EXPECTF-- +Warning: Cannot unbind $this of internal method in %s on line %d diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 4430e7b250..6631193e13 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -173,6 +173,12 @@ ZEND_METHOD(Closure, bind) zend_error(E_WARNING, "Cannot bind an instance to a static closure"); } + if (newthis == NULL && !(closure->func.common.fn_flags & ZEND_ACC_STATIC) + && closure->func.type == ZEND_INTERNAL_FUNCTION) { + zend_error(E_WARNING, "Cannot unbind $this of internal method"); + return; + } + if (scope_arg != NULL) { /* scope argument was given */ if (Z_TYPE_P(scope_arg) == IS_OBJECT) { ce = Z_OBJCE_P(scope_arg); |