Skip to content

Commit d26965b

Browse files
committed
Fixed bug #81626
Backport of a892647 to 7.4.
1 parent 18a0d46 commit d26965b

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.4.27
44

5+
- Core:
6+
. Fixed bug #81626 (Error on use static:: in __сallStatic() wrapped to
7+
Closure::fromCallable()). (Nikita)
8+
59
- FPM:
610
. Fixed bug #81513 (Future possibility for heap overflow in FPM zlog).
711
(Jakub Zelenka)

Zend/tests/bug81626.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #81626: Error on use static:: in __сallStatic() wrapped to Closure::fromCallable()
3+
--FILE--
4+
<?php
5+
class TestClass {
6+
public static bool $wasCalled = false;
7+
public static function __callStatic(string $name, array $args): string
8+
{
9+
static::$wasCalled = true;
10+
return 'ok';
11+
}
12+
}
13+
$closure = Closure::fromCallable([TestClass::class, 'foo']);
14+
var_dump($closure());
15+
?>
16+
--EXPECT--
17+
string(2) "ok"

Zend/zend_closures.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
270270
}
271271

272272
fcc.object = fci.object = Z_OBJ_P(ZEND_THIS);
273+
fcc.called_scope = zend_get_called_scope(EG(current_execute_data));
273274

274275
zend_call_function(&fci, &fcc);
275276

0 commit comments

Comments
 (0)