mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.5'
* PHP-8.5: Fix dumping function signature with dynamic class const lookup default argument
This commit is contained in:
16
Zend/tests/oss-fuzz-465488618.phpt
Normal file
16
Zend/tests/oss-fuzz-465488618.phpt
Normal file
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
OSS-Fuzz #465488618: Dump function signature with dynamic class const lookup default argument
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
public function test(int $x) {}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
public function test(string $x = Foo::{C}) {}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Declaration of B::test(string $x = <expression>) must be compatible with A::test(int $x) in %s on line %d
|
||||
@@ -1011,7 +1011,9 @@ static ZEND_COLD zend_string *zend_get_function_declaration(
|
||||
zend_ast *ast = Z_ASTVAL_P(zv);
|
||||
if (ast->kind == ZEND_AST_CONSTANT) {
|
||||
smart_str_append(&str, zend_ast_get_constant_name(ast));
|
||||
} else if (ast->kind == ZEND_AST_CLASS_CONST) {
|
||||
} else if (ast->kind == ZEND_AST_CLASS_CONST
|
||||
&& ast->child[1]->kind == ZEND_AST_ZVAL
|
||||
&& Z_TYPE_P(zend_ast_get_zval(ast->child[1])) == IS_STRING) {
|
||||
smart_str_append(&str, zend_ast_get_str(ast->child[0]));
|
||||
smart_str_appends(&str, "::");
|
||||
smart_str_append(&str, zend_ast_get_str(ast->child[1]));
|
||||
|
||||
Reference in New Issue
Block a user