mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Fix assertion violation for invalid class const objects in const expressions (#11458)
Fixes oss-fuzz #59764
This commit is contained in:
parent
6c015ae8fe
commit
fae42c8bd8
8
Zend/tests/oss_fuzz_59764.phpt
Normal file
8
Zend/tests/oss_fuzz_59764.phpt
Normal file
@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
oss-fuzz #59764: Test
|
||||
--FILE--
|
||||
<?php
|
||||
const B = []::{A};
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Class name must be a valid object or a string in %s on line %d
|
@ -10014,6 +10014,9 @@ static void zend_compile_const_expr_class_const(zend_ast **ast_ptr) /* {{{ */
|
||||
zend_error_noreturn(E_COMPILE_ERROR,
|
||||
"Dynamic class names are not allowed in compile-time class constant references");
|
||||
}
|
||||
if (Z_TYPE_P(zend_ast_get_zval(class_ast)) != IS_STRING) {
|
||||
zend_throw_error(NULL, "Class name must be a valid object or a string");
|
||||
}
|
||||
|
||||
class_name = zend_ast_get_str(class_ast);
|
||||
fetch_type = zend_get_class_fetch_type(class_name);
|
||||
|
Loading…
Reference in New Issue
Block a user