Skip to content

Commit a908afe

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Fixed bug #65969 (Chain assignment with T_LIST failure) Conflicts: NEWS Zend/zend_vm_def.h Zend/zend_vm_execute.h
2 parents 1daa1ab + 92b7668 commit a908afe

File tree

4 files changed

+163
-285
lines changed

4 files changed

+163
-285
lines changed

Zend/tests/bug65969.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Bug #65969 (Chain assignment with T_LIST failure)
3+
--FILE--
4+
<?php
5+
$obj = new stdClass;
6+
list($a,$b) = $obj->prop = [1,2];
7+
var_dump($a,$b);
8+
--EXPECT--
9+
int(1)
10+
int(2)

Zend/zend_execute.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,9 +1248,8 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container
12481248
}
12491249
}
12501250

1251-
static void zend_fetch_dimension_address_read(temp_variable *result, zval **container_ptr, zval *dim, int dim_type, int type TSRMLS_DC)
1251+
static void zend_fetch_dimension_address_read(temp_variable *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
12521252
{
1253-
zval *container = *container_ptr;
12541253
zval **retval;
12551254

12561255
switch (Z_TYPE_P(container)) {

Zend/zend_vm_def.h

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,24 +1164,15 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
11641164
{
11651165
USE_OPLINE
11661166
zend_free_op free_op1, free_op2;
1167-
zval **container;
1167+
zval *container;
11681168

11691169
SAVE_OPLINE();
1170-
1171-
if (OP1_TYPE == IS_TMP_VAR || OP1_TYPE == IS_CONST) {
1172-
zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R);
1173-
zend_fetch_dimension_address_read(&EX_T(opline->result.var), &container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
1174-
FREE_OP2();
1170+
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
1171+
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
1172+
FREE_OP2();
1173+
if (OP1_TYPE != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
11751174
FREE_OP1();
1176-
} else {
1177-
container = GET_OP1_ZVAL_PTR_PTR_FAST(BP_VAR_R);
1178-
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
1179-
FREE_OP2();
1180-
if (OP1_TYPE == IS_VAR && !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
1181-
FREE_OP1_VAR_PTR_FAST();
1182-
}
11831175
}
1184-
11851176
CHECK_EXCEPTION();
11861177
ZEND_VM_NEXT_OPCODE();
11871178
}
@@ -1246,13 +1237,13 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
12461237
{
12471238
USE_OPLINE
12481239
zend_free_op free_op1, free_op2;
1249-
zval **container;
1240+
zval *container;
12501241

12511242
SAVE_OPLINE();
1252-
container = GET_OP1_ZVAL_PTR_PTR_FAST(BP_VAR_IS);
1243+
container = GET_OP1_ZVAL_PTR(BP_VAR_IS);
12531244
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_IS TSRMLS_CC);
12541245
FREE_OP2();
1255-
FREE_OP1_VAR_PTR_FAST();
1246+
FREE_OP1();
12561247
CHECK_EXCEPTION();
12571248
ZEND_VM_NEXT_OPCODE();
12581249
}
@@ -1261,12 +1252,12 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
12611252
{
12621253
USE_OPLINE
12631254
zend_free_op free_op1, free_op2;
1264-
zval **container;
12651255

12661256
SAVE_OPLINE();
12671257

12681258
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
1269-
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
1259+
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
1260+
12701261
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
12711262
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
12721263
}
@@ -1277,13 +1268,15 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
12771268
FREE_OP2();
12781269
FREE_OP1_VAR_PTR();
12791270
} else {
1271+
zval *container;
1272+
12801273
if (OP2_TYPE == IS_UNUSED) {
12811274
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
12821275
}
1283-
container = GET_OP1_ZVAL_PTR_PTR_FAST(BP_VAR_R);
1276+
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
12841277
zend_fetch_dimension_address_read(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC);
12851278
FREE_OP2();
1286-
FREE_OP1_VAR_PTR_FAST();
1279+
FREE_OP1();
12871280
}
12881281
CHECK_EXCEPTION();
12891282
ZEND_VM_NEXT_OPCODE();

0 commit comments

Comments
 (0)