Skip to content

Commit fda0ebf

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Tracing JIT: Fixed incorrect assumtion about temporary variable types clobbered by *_ROPE instructions Revert "Fix bug GH-1 (mysqli_sql_exception->sqlstate is inaccessible)" Fix bug GH-1 (mysqli_sql_exception->sqlstate is inaccessible)
2 parents 7614542 + b5a6e51 commit fda0ebf

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6065,6 +6065,19 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
60656065
SET_STACK_REG(stack, EX_VAR_TO_NUM(opline->op1.var), ZREG_NONE);
60666066
}
60676067

6068+
if (opline->opcode == ZEND_ROPE_INIT) {
6069+
/* clear stack slots used by rope */
6070+
uint32_t var = EX_VAR_TO_NUM(opline->result.var);
6071+
uint32_t count =
6072+
((opline->extended_value * sizeof(void*)) + (sizeof(zval)-1)) / sizeof(zval);
6073+
6074+
do {
6075+
SET_STACK_TYPE(stack, var, IS_UNKNOWN, 1);
6076+
var++;
6077+
count--;
6078+
} while (count);
6079+
}
6080+
60686081
if (ssa_op) {
60696082
zend_ssa_range tmp;
60706083

ext/opcache/tests/jit/rope_001.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
JIT ROPE: 001 *_ROPE may types of temporary variables
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
$a = "";
11+
$b = 1;
12+
var_dump(" $a $a" == " $a" . -$b);
13+
var_dump(" $a $a" == " $a" . -$b);
14+
?>
15+
--EXPECT--
16+
bool(false)
17+
bool(false)

0 commit comments

Comments
 (0)