File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #69871 (Short-circuiting failure with smart_branch)
3
+ --FILE--
4
+ <?php
5
+
6
+ $ a = true ;
7
+ if (isset ($ a ) && 0 ) {
8
+ var_dump (true );
9
+ } else {
10
+ var_dump (false );
11
+ }
12
+
13
+ ?>
14
+ --EXPECT--
15
+ bool(false)
Original file line number Diff line number Diff line change @@ -2428,9 +2428,21 @@ static zend_always_inline zend_generator *zend_get_running_generator(zend_execut
2428
2428
# define ZEND_VM_SMART_BRANCH (_result , _check ) do { \
2429
2429
int __result; \
2430
2430
if (EXPECTED((opline+1)->opcode == ZEND_JMPZ)) { \
2431
- __result = (_result); \
2431
+ if (UNEXPECTED((opline+1)->op1_type == IS_CONST)) { \
2432
+ zend_uchar __type = Z_TYPE_P(EX_CONSTANT((opline+1)->op1)); \
2433
+ ZEND_ASSERT(__type == IS_TRUE || __type == IS_FALSE); /* assume boolean */ \
2434
+ __result = __type == IS_TRUE ; \
2435
+ } else { \
2436
+ __result = (_result ); \
2437
+ } \
2432
2438
} else if (EXPECTED ((opline + 1 )-> opcode == ZEND_JMPNZ )) { \
2433
- __result = !(_result); \
2439
+ if (UNEXPECTED ((opline + 1 )-> op1_type == IS_CONST )) { \
2440
+ zend_uchar __type = Z_TYPE_P (EX_CONSTANT ((opline + 1 )-> op1 )); \
2441
+ ZEND_ASSERT (__type == IS_TRUE || __type == IS_FALSE ); /* assume boolean */ \
2442
+ __result = __type != IS_TRUE ; \
2443
+ } else { \
2444
+ __result = !(_result ); \
2445
+ } \
2434
2446
} else { \
2435
2447
break ; \
2436
2448
} \
You can’t perform that action at this time.
0 commit comments