Skip to content

Commit 5deb3cb

Browse files
authored
zend_compile: Adjust array_map() optimization after review feedback
1 parent 3497dbb commit 5deb3cb

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

Zend/zend_compile.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5054,24 +5054,22 @@ static zend_result zend_compile_func_array_map(znode *result, zend_ast_list *arg
50545054
/* Bail out if the callback is assert() due to the AST stringification logic
50555055
* breaking for the generated call.
50565056
*/
5057-
if (
5058-
callback->kind == ZEND_AST_CALL
5059-
&& callback->child[0]->kind == ZEND_AST_ZVAL
5060-
&& Z_TYPE_P(zend_ast_get_zval(callback->child[0])) == IS_STRING
5061-
&& zend_string_equals_literal_ci(zend_ast_get_str(callback->child[0]), "assert")
5062-
) {
5057+
if (callback->kind == ZEND_AST_CALL
5058+
&& callback->child[0]->kind == ZEND_AST_ZVAL
5059+
&& Z_TYPE_P(zend_ast_get_zval(callback->child[0])) == IS_STRING
5060+
&& zend_string_equals_literal_ci(zend_ast_get_str(callback->child[0]), "assert")) {
50635061
return FAILURE;
50645062
}
50655063

5066-
znode value;
5067-
value.op_type = IS_TMP_VAR;
5068-
value.u.op.var = get_temporary_variable();
5069-
50705064
zend_ast_list *callback_args = zend_ast_get_list(((zend_ast_fcc*)args_ast)->args);
50715065
if (callback_args->children != 1 || callback_args->child[0]->attr != ZEND_PLACEHOLDER_VARIADIC) {
50725066
/* Full PFA is not yet implemented, will fail in zend_compile_call_common(). */
50735067
return FAILURE;
50745068
}
5069+
5070+
znode value;
5071+
value.op_type = IS_TMP_VAR;
5072+
value.u.op.var = get_temporary_variable();
50755073
zend_ast *call_args = zend_ast_create_list(1, ZEND_AST_ARG_LIST, zend_ast_create_znode(&value));
50765074

50775075
zend_op *opline;

0 commit comments

Comments
 (0)