mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Prevent compile-time evaluation of implode() with arguments causing run-time warnings
This commit is contained in:
parent
0e882f189a
commit
e7f69f07fc
1 changed files with 15 additions and 0 deletions
|
@ -596,6 +596,21 @@ static inline int ct_eval_func_call(
|
|||
&& ((num_args == 1 && Z_TYPE_P(args[0]) == IS_ARRAY)
|
||||
|| (num_args == 2 && Z_TYPE_P(args[0]) == IS_STRING && Z_TYPE_P(args[1]) == IS_ARRAY)
|
||||
|| (num_args == 2 && Z_TYPE_P(args[0]) == IS_ARRAY && Z_TYPE_P(args[1]) == IS_STRING))) {
|
||||
zval *entry;
|
||||
|
||||
if (Z_TYPE_P(args[0]) == IS_ARRAY) {
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(args[0]), entry) {
|
||||
if (Z_TYPE_P(entry) > IS_STRING) {
|
||||
return FAILURE;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} else {
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(args[1]), entry) {
|
||||
if (Z_TYPE_P(entry) > IS_STRING) {
|
||||
return FAILURE;
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
/* pass */
|
||||
} else {
|
||||
return FAILURE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue