Skip to content

Commit 78b2cf6

Browse files
committed
Review zend_is_true() usage in zend_compile.c
1 parent 167a199 commit 78b2cf6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Zend/zend_compile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10097,6 +10097,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
1009710097
}
1009810098

1009910099
child0_is_true = zend_is_true(zend_ast_get_zval(ast->child[0]));
10100+
/* TODO Check if need to handle potential TypeError if child[0] is an object which cannot be converted to bool */
1010010101
if (child0_is_true == (ast->kind == ZEND_AST_OR)) {
1010110102
ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
1010210103
break;
@@ -10107,6 +10108,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
1010710108
}
1010810109

1010910110
child1_is_true = zend_is_true(zend_ast_get_zval(ast->child[1]));
10111+
/* TODO Check if need to handle potential TypeError if child[1] is an object which cannot be converted to bool */
1011010112
if (ast->kind == ZEND_AST_OR) {
1011110113
ZVAL_BOOL(&result, child0_is_true || child1_is_true);
1011210114
} else {
@@ -10173,6 +10175,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
1017310175
}
1017410176

1017510177
child = &ast->child[2 - zend_is_true(zend_ast_get_zval(ast->child[0]))];
10178+
/* TODO Check if need to handle potential TypeError if child[0] is an object which cannot be converted to bool */
1017610179
if (*child == NULL) {
1017710180
child--;
1017810181
}

0 commit comments

Comments
 (0)