Skip to content

Commit 968a399

Browse files
committed
Add additional JIT test, add missing SET_EX_OPLINE
1 parent 4725a9b commit 968a399

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

Zend/tests/readonly_props/cache_slot.phpt

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,40 @@ echo "\n";
5151

5252
$test = new Test;
5353
$test->initProp3();
54+
$test->replaceProp3();
55+
var_dump($test->prop3);
56+
$test->replaceProp3();
57+
var_dump($test->prop3);
58+
echo "\n";
59+
60+
// Test variations using closure rebinding, so we have unknown property_info in JIT.
61+
$test = new Test;
62+
(function() { $this->prop2 = []; })->call($test);
63+
$appendProp2 = (function() {
64+
$this->prop2[] = 1;
65+
})->bindTo($test, Test::class);
5466
try {
55-
$test->replaceProp3();
67+
$appendProp2();
5668
} catch (Error $e) {
5769
echo $e->getMessage(), "\n";
5870
}
59-
var_dump($test->prop3);
6071
try {
61-
$test->replaceProp3();
72+
$appendProp2();
6273
} catch (Error $e) {
6374
echo $e->getMessage(), "\n";
6475
}
76+
var_dump($test->prop2);
77+
echo "\n";
78+
79+
$test = new Test;
80+
$replaceProp3 = (function() {
81+
$ref =& $this->prop3;
82+
$ref = new stdClass;
83+
})->bindTo($test, Test::class);
84+
$test->initProp3();
85+
$replaceProp3();
86+
var_dump($test->prop3);
87+
$replaceProp3();
6588
var_dump($test->prop3);
6689

6790
?>
@@ -83,3 +106,17 @@ object(stdClass)#3 (1) {
83106
["foo"]=>
84107
int(1)
85108
}
109+
110+
Cannot modify readonly property Test::$prop2
111+
Cannot modify readonly property Test::$prop2
112+
array(0) {
113+
}
114+
115+
object(stdClass)#5 (1) {
116+
["foo"]=>
117+
int(1)
118+
}
119+
object(stdClass)#5 (1) {
120+
["foo"]=>
121+
int(1)
122+
}

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11849,6 +11849,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst,
1184911849
| b >9
1185011850
|2:
1185111851
| mov FCARG1x, FCARG2x
11852+
| SET_EX_OPLINE opline, REG0
1185211853
| EXT_CALL zend_readonly_property_modification_error, REG0
1185311854
| SET_ZVAL_TYPE_INFO res_addr, _IS_ERROR, TMP1w, TMP2
1185411855
| b >9
@@ -11893,6 +11894,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst,
1189311894
|.cold_code
1189411895
|4:
1189511896
| LOAD_ADDR FCARG1x, prop_info
11897+
| SET_EX_OPLINE opline, REG0
1189611898
| EXT_CALL zend_readonly_property_modification_error, REG0
1189711899
| SET_ZVAL_TYPE_INFO res_addr, _IS_ERROR, TMP1w, TMP2
1189811900
| b >9

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12530,6 +12530,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst,
1253012530
| jmp >9
1253112531
|2:
1253212532
| mov FCARG1a, FCARG2a
12533+
| SET_EX_OPLINE opline, r0
1253312534
| EXT_CALL zend_readonly_property_modification_error, r0
1253412535
| SET_ZVAL_TYPE_INFO res_addr, _IS_ERROR
1253512536
| jmp >9
@@ -12582,6 +12583,7 @@ static int zend_jit_fetch_obj(dasm_State **Dst,
1258212583
|.cold_code
1258312584
|4:
1258412585
| LOAD_ADDR FCARG1a, prop_info
12586+
| SET_EX_OPLINE opline, r0
1258512587
| EXT_CALL zend_readonly_property_modification_error, r0
1258612588
| SET_ZVAL_TYPE_INFO res_addr, _IS_ERROR
1258712589
| jmp >9

0 commit comments

Comments
 (0)