Skip to content

Commit 61eca66

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix dumping function signature with dynamic class const lookup default argument
2 parents 83b36de + 26c0cbd commit 61eca66

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
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 8.4.17
44

5+
- Core:
6+
. Fix OSS-Fuzz #465488618 (Wrong assumptions when dumping function signature
7+
with dynamic class const lookup default argument). (ilutov)
8+
59
- Bz2:
610
. Fixed bug GH-20620 (bzcompress overflow on large source size).
711
(David Carlier)

Zend/tests/oss-fuzz-465488618.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
OSS-Fuzz #465488618: Dump function signature with dynamic class const lookup default argument
3+
--FILE--
4+
<?php
5+
6+
class A {
7+
public function test(int $x) {}
8+
}
9+
10+
class B extends A {
11+
public function test(string $x = Foo::{C}) {}
12+
}
13+
14+
?>
15+
--EXPECTF--
16+
Fatal error: Declaration of B::test(string $x = <expression>) must be compatible with A::test(int $x) in %s on line %d

Zend/zend_inheritance.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,9 @@ static ZEND_COLD zend_string *zend_get_function_declaration(
988988
zend_ast *ast = Z_ASTVAL_P(zv);
989989
if (ast->kind == ZEND_AST_CONSTANT) {
990990
smart_str_append(&str, zend_ast_get_constant_name(ast));
991-
} else if (ast->kind == ZEND_AST_CLASS_CONST) {
991+
} else if (ast->kind == ZEND_AST_CLASS_CONST
992+
&& ast->child[1]->kind == ZEND_AST_ZVAL
993+
&& Z_TYPE_P(zend_ast_get_zval(ast->child[1])) == IS_STRING) {
992994
smart_str_append(&str, zend_ast_get_str(ast->child[0]));
993995
smart_str_appends(&str, "::");
994996
smart_str_append(&str, zend_ast_get_str(ast->child[1]));

0 commit comments

Comments
 (0)