Skip to content

Commit 62f17c1

Browse files
committed
Review zend_is_true() usage in zend_compile.c
1 parent 8ee2f61 commit 62f17c1

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
@@ -10165,6 +10165,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
1016510165
}
1016610166

1016710167
child0_is_true = zend_is_true(zend_ast_get_zval(ast->child[0]));
10168+
/* TODO Check if need to handle potential TypeError if child[0] is an object which cannot be converted to bool */
1016810169
if (child0_is_true == (ast->kind == ZEND_AST_OR)) {
1016910170
ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
1017010171
break;
@@ -10175,6 +10176,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
1017510176
}
1017610177

1017710178
child1_is_true = zend_is_true(zend_ast_get_zval(ast->child[1]));
10179+
/* TODO Check if need to handle potential TypeError if child[1] is an object which cannot be converted to bool */
1017810180
if (ast->kind == ZEND_AST_OR) {
1017910181
ZVAL_BOOL(&result, child0_is_true || child1_is_true);
1018010182
} else {
@@ -10241,6 +10243,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
1024110243
}
1024210244

1024310245
child = &ast->child[2 - zend_is_true(zend_ast_get_zval(ast->child[0]))];
10246+
/* TODO Check if need to handle potential TypeError if child[0] is an object which cannot be converted to bool */
1024410247
if (*child == NULL) {
1024510248
child--;
1024610249
}

0 commit comments

Comments
 (0)