diff options
| author | Xinchen Hui <laruence@php.net> | 2015-06-18 22:30:01 +0800 |
|---|---|---|
| committer | Xinchen Hui <laruence@php.net> | 2015-06-18 22:30:35 +0800 |
| commit | d54e6f015b88cd6e101b6ff5111780cd8935d3d3 (patch) | |
| tree | d91bf09e67a71d8ea8bee349b97fdd75442cd838 | |
| parent | 20f34166829a6f6c4b4f5f05b10ca296e3742f1c (diff) | |
| parent | fae6bedea5e094a1f6ddbd1a4453eaea340d1855 (diff) | |
| download | php-git-d54e6f015b88cd6e101b6ff5111780cd8935d3d3.tar.gz | |
Merge branch 'master' of git.php.net:php-src
| -rw-r--r-- | NEWS | 1 | ||||
| -rw-r--r-- | Zend/tests/bug69871.phpt | 15 | ||||
| -rw-r--r-- | Zend/zend_execute.c | 16 |
3 files changed, 30 insertions, 2 deletions
@@ -3,6 +3,7 @@ PHP NEWS 25 Jun 2015, PHP 7.0.0 Alpha 2 - Core: + . Fixed bug #69872 (uninitialised value in strtr with array). (Laruence) . Fixed bug #69868 (Invalid read of size 1 in zend_compile_short_circuiting). (Laruence) . Fixed bug #69823 (PHP 7.0.0alpha1 segmentation fault when exactly 33 diff --git a/Zend/tests/bug69871.phpt b/Zend/tests/bug69871.phpt new file mode 100644 index 0000000000..7b87a7507c --- /dev/null +++ b/Zend/tests/bug69871.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #69871 (Short-circuiting failure with smart_branch) +--FILE-- +<?php + +$a = true; +if (isset($a) && 0) { + var_dump(true); +} else { + var_dump(false); +} + +?> +--EXPECT-- +bool(false) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 9190eff2c3..27274d334d 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2428,9 +2428,21 @@ static zend_always_inline zend_generator *zend_get_running_generator(zend_execut # define ZEND_VM_SMART_BRANCH(_result, _check) do { \ int __result; \ if (EXPECTED((opline+1)->opcode == ZEND_JMPZ)) { \ - __result = (_result); \ + if (UNEXPECTED((opline+1)->op1_type == IS_CONST)) { \ + zend_uchar __type = Z_TYPE_P(EX_CONSTANT((opline+1)->op1)); \ + ZEND_ASSERT(__type == IS_TRUE || __type == IS_FALSE); /* assume boolean */ \ + __result = __type == IS_TRUE; \ + } else { \ + __result = (_result); \ + } \ } else if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \ - __result = !(_result); \ + if (UNEXPECTED((opline+1)->op1_type == IS_CONST)) { \ + zend_uchar __type = Z_TYPE_P(EX_CONSTANT((opline+1)->op1)); \ + ZEND_ASSERT(__type == IS_TRUE || __type == IS_FALSE); /* assume boolean */ \ + __result = __type != IS_TRUE; \ + } else { \ + __result = !(_result); \ + } \ } else { \ break; \ } \ |
