mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Set called_scope in Closure::call (fixes bug #70987)
This commit is contained in:
parent
a347b0be48
commit
8907da99b8
2 changed files with 16 additions and 0 deletions
15
Zend/tests/bug70987.phpt
Normal file
15
Zend/tests/bug70987.phpt
Normal file
|
@ -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"
|
|
@ -150,6 +150,7 @@ ZEND_METHOD(Closure, call)
|
||||||
fci.param_count = my_param_count;
|
fci.param_count = my_param_count;
|
||||||
fci.object = fci_cache.object = newobj;
|
fci.object = fci_cache.object = newobj;
|
||||||
fci_cache.initialized = 1;
|
fci_cache.initialized = 1;
|
||||||
|
fci_cache.called_scope = Z_OBJCE_P(newthis);
|
||||||
|
|
||||||
if (fci_cache.function_handler->common.fn_flags & ZEND_ACC_GENERATOR) {
|
if (fci_cache.function_handler->common.fn_flags & ZEND_ACC_GENERATOR) {
|
||||||
zval new_closure;
|
zval new_closure;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue