com php-src: Set called_scope in Closure::call (f ixes bug #70987): Zend/tests/bug709 87.phpt Zend/zend_closures.c

From: Date: Fri, 27 Nov 2015 15:06:13 +0000
Subject: com php-src: Set called_scope in Closure::call (f ixes bug #70987): Zend/tests/bug709 87.phpt Zend/zend_closures.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90047@lists.php.net to get a copy of this message
Commit: 8907da99b83204958cb2308ec12aa9e490372150 Author: Andrea Faulds <ajf@ajf.me> Fri, 27 Nov 2015 15:06:13 +0000 Parents: a347b0be48d892c105198b23868f37a0d4f92dee Branches: PHP-7.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8907da99b83204958cb2308ec12aa9e490372150 Log: Set called_scope in Closure::call (fixes bug #70987) Bugs: https://bugs.php.net/70987 Changed paths: A Zend/tests/bug70987.phpt M Zend/zend_closures.c Diff: diff --git a/Zend/tests/bug70987.phpt b/Zend/tests/bug70987.phpt new file mode 100644 index 0000000..d31a1d2 --- /dev/null +++ b/Zend/tests/bug70987.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #70987 (static::class within Closure::call() causes segfault) +--FILE-- +<?php + +class foo {} +$bar = function () { + return static::class; +}; + +var_dump($bar->call(new foo)); + +?> +--EXPECTF-- +string(3) "foo" diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 76b10e4..beca1ce 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -150,6 +150,7 @@ ZEND_METHOD(Closure, call) fci.param_count = my_param_count; fci.object = fci_cache.object = newobj; fci_cache.initialized = 1; + fci_cache.called_scope = Z_OBJCE_P(newthis); if (fci_cache.function_handler->common.fn_flags & ZEND_ACC_GENERATOR) { zval new_closure;

« previous php.cvs (#90047) next »