@@ -5415,15 +5415,7 @@ static zend_result zend_compile_func_array_map(znode *result, zend_ast_list *arg
54155415 zend_ast * call_args = zend_partial_apply (callback ,
54165416 zend_ast_create_znode (& value ));
54175417 if (!call_args ) {
5418- CG (active_op_array )-> T -- ;
5419- if (func_node .op_type == IS_CONST ) {
5420- zval_ptr_dtor_nogc (& func_node .u .constant );
5421- }
5422- if (class_node .op_type == IS_CONST ) {
5423- zval_ptr_dtor_nogc (& class_node .u .constant );
5424- }
5425- /* The callback is not a FCC/PFA, or is not optimizable */
5426- return FAILURE ;
5418+ goto fail ;
54275419 }
54285420
54295421 zend_op * opline ;
@@ -5432,6 +5424,10 @@ static zend_result zend_compile_func_array_map(znode *result, zend_ast_list *arg
54325424 zend_compile_expr (& array , args -> child [1 ]);
54335425 /* array is an argument to both ZEND_TYPE_ASSERT and to ZEND_FE_RESET_R. */
54345426 if (array .op_type == IS_CONST ) {
5427+ if (Z_TYPE (array .u .constant ) != IS_ARRAY ) {
5428+ zval_ptr_dtor_nogc (& array .u .constant );
5429+ goto fail ;
5430+ }
54355431 Z_TRY_ADDREF (array .u .constant );
54365432 }
54375433
@@ -5512,6 +5508,17 @@ static zend_result zend_compile_func_array_map(znode *result, zend_ast_list *arg
55125508 }
55135509
55145510 return SUCCESS ;
5511+
5512+ fail :
5513+ CG (active_op_array )-> T -- ;
5514+ if (func_node .op_type == IS_CONST ) {
5515+ zval_ptr_dtor_nogc (& func_node .u .constant );
5516+ }
5517+ if (class_node .op_type == IS_CONST ) {
5518+ zval_ptr_dtor_nogc (& class_node .u .constant );
5519+ }
5520+
5521+ return FAILURE ;
55155522}
55165523
55175524static zend_result zend_try_compile_special_func_ex (znode * result , zend_string * lcname , zend_ast_list * args , uint32_t type , uint32_t lineno ) /* {{{ */
0 commit comments