Backport of a8926474cb to 7.4.
This commit is contained in:
Nikita Popov 2021-11-16 12:44:51 +01:00
parent 18a0d46a1b
commit d26965b247
3 changed files with 22 additions and 0 deletions

4
NEWS
View File

@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.4.27
- Core:
. Fixed bug #81626 (Error on use static:: in __сallStatic() wrapped to
Closure::fromCallable()). (Nikita)
- FPM:
. Fixed bug #81513 (Future possibility for heap overflow in FPM zlog).
(Jakub Zelenka)

17
Zend/tests/bug81626.phpt Normal file
View File

@ -0,0 +1,17 @@
--TEST--
Bug #81626: Error on use static:: in __сallStatic() wrapped to Closure::fromCallable()
--FILE--
<?php
class TestClass {
public static bool $wasCalled = false;
public static function __callStatic(string $name, array $args): string
{
static::$wasCalled = true;
return 'ok';
}
}
$closure = Closure::fromCallable([TestClass::class, 'foo']);
var_dump($closure());
?>
--EXPECT--
string(2) "ok"

View File

@ -270,6 +270,7 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
}
fcc.object = fci.object = Z_OBJ_P(ZEND_THIS);
fcc.called_scope = zend_get_called_scope(EG(current_execute_data));
zend_call_function(&fci, &fcc);