diff options
author | Dmitry Stogov <dmitry@zend.com> | 2021-03-17 16:55:42 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2021-03-17 16:55:42 +0300 |
commit | 8f0ca7c16cf13a9b3856e517d5394b801c1bdffc (patch) | |
tree | bf4d3f9dfa808c5f8bb9662588daa18babe46cc2 | |
parent | 356ef5bd0e871d58c274110d3689870b8cb264b9 (diff) | |
parent | faf1567212bb83e39bf113149bf31abf719ca3a5 (diff) | |
download | php-git-8f0ca7c16cf13a9b3856e517d5394b801c1bdffc.tar.gz |
Merge branch 'PHP-8.0'
* PHP-8.0:
Fixed bug #80839 (PHP problem with JIT)
-rw-r--r-- | ext/opcache/jit/zend_jit_x86.dasc | 6 | ||||
-rw-r--r-- | ext/opcache/tests/jit/bug80839.phpt | 37 |
2 files changed, 43 insertions, 0 deletions
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index b87ab63398..8bad99f95f 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -5221,6 +5221,9 @@ static int zend_jit_concat_helper(dasm_State **Dst, | add r4, 12 |.endif } + /* concatination with empty string may increase refcount */ + op1_info |= MAY_BE_RCN; + op2_info |= MAY_BE_RCN; | FREE_OP op1_type, op1, op1_info, 0, opline | FREE_OP op2_type, op2, op2_info, 0, opline |5: @@ -5247,6 +5250,9 @@ static int zend_jit_concat_helper(dasm_State **Dst, |.if not(X64) | add r4, 12 |.endif + /* concatination with empty string may increase refcount */ + op1_info |= MAY_BE_RCN; + op2_info |= MAY_BE_RCN; | FREE_OP op1_type, op1, op1_info, 0, opline | FREE_OP op2_type, op2, op2_info, 0, opline if (may_throw) { diff --git a/ext/opcache/tests/jit/bug80839.phpt b/ext/opcache/tests/jit/bug80839.phpt new file mode 100644 index 0000000000..efa697ecdc --- /dev/null +++ b/ext/opcache/tests/jit/bug80839.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #80839: PHP problem with JIT +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit_buffer_size=1M +opcache.jit=function +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +$a = null; // the problem only occurs when set to NULL +test($a, 'y'); + +function test($str, $pad) { + $x = $str . str_repeat($pad, 15); // $x now contains "yyyyyyyyyyyyyyy" + var_dump($x); + + $gft = new gft(); + $gft->info(33); + + // $x has been changed ???? + // $x contains what was echoed in the function 'info' + var_dump($x); +} +class gft { + private $strVal = 'abcd '; + public function info($info, $prefix = ' Info:') { + echo $this->strVal.$prefix.serialize($info).'aaaa'; + echo "\n"; + } +} +?> +--EXPECT-- +string(15) "yyyyyyyyyyyyyyy" +abcd Info:i:33;aaaa +string(15) "yyyyyyyyyyyyyyy" |