Skip to content

Commit 92b7668

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

File tree

5 files changed

+230
-363
lines changed

5 files changed

+230
-363
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ PHP NEWS
1212
- Core:
1313
. Fixed bug #66094 (unregister_tick_function tries to cast a Closure to a
1414
string). (Laruence)
15+
. Fixed bug #65969 (Chain assignment with T_LIST failure). (Dmitry)
1516

1617
- OPCache
1718
. Fixed bug #66176 (Invalid constant substitution). (Dmitry)

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
@@ -1247,9 +1247,8 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container
12471247
}
12481248
}
12491249

1250-
static void zend_fetch_dimension_address_read(temp_variable *result, zval **container_ptr, zval *dim, int dim_type, int type TSRMLS_DC)
1250+
static void zend_fetch_dimension_address_read(temp_variable *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
12511251
{
1252-
zval *container = *container_ptr;
12531252
zval **retval;
12541253

12551254
switch (Z_TYPE_P(container)) {

Zend/zend_vm_def.h

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,28 +1166,17 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
11661166
{
11671167
USE_OPLINE
11681168
zend_free_op free_op1, free_op2;
1169-
zval **container;
1169+
zval *container;
11701170

11711171
SAVE_OPLINE();
11721172

1173-
if ((opline->extended_value & ZEND_FETCH_ADD_LOCK) &&
1174-
OP1_TYPE != IS_CV &&
1175-
EX_T(opline->op1.var).var.ptr_ptr) {
1176-
PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
1177-
}
1178-
1179-
if (OP1_TYPE == IS_TMP_VAR || OP1_TYPE == IS_CONST) {
1180-
zval *container = GET_OP1_ZVAL_PTR(BP_VAR_R);
1181-
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);
1182-
FREE_OP2();
1183-
FREE_OP1();
1184-
} else {
1185-
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
1186-
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);
1187-
FREE_OP2();
1188-
FREE_OP1_VAR_PTR();
1173+
if (OP1_TYPE == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
1174+
PZVAL_LOCK(EX_T(opline->op1.var).var.ptr);
11891175
}
1190-
1176+
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
1177+
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);
1178+
FREE_OP2();
1179+
FREE_OP1();
11911180
CHECK_EXCEPTION();
11921181
ZEND_VM_NEXT_OPCODE();
11931182
}
@@ -1252,13 +1241,13 @@ ZEND_VM_HANDLER(90, ZEND_FETCH_DIM_IS, VAR|CV, CONST|TMP|VAR|CV)
12521241
{
12531242
USE_OPLINE
12541243
zend_free_op free_op1, free_op2;
1255-
zval **container;
1244+
zval *container;
12561245

12571246
SAVE_OPLINE();
1258-
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_IS);
1247+
container = GET_OP1_ZVAL_PTR(BP_VAR_IS);
12591248
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);
12601249
FREE_OP2();
1261-
FREE_OP1_VAR_PTR();
1250+
FREE_OP1();
12621251
CHECK_EXCEPTION();
12631252
ZEND_VM_NEXT_OPCODE();
12641253
}
@@ -1267,28 +1256,32 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
12671256
{
12681257
USE_OPLINE
12691258
zend_free_op free_op1, free_op2;
1270-
zval **container;
12711259

12721260
SAVE_OPLINE();
12731261

12741262
if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->fbc, (opline->extended_value & ZEND_FETCH_ARG_MASK))) {
1275-
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
1263+
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
1264+
12761265
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
12771266
zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
12781267
}
12791268
zend_fetch_dimension_address(&EX_T(opline->result.var), container, GET_OP2_ZVAL_PTR(BP_VAR_R), OP2_TYPE, BP_VAR_W TSRMLS_CC);
12801269
if (OP1_TYPE == IS_VAR && OP1_FREE && READY_TO_DESTROY(free_op1.var)) {
12811270
EXTRACT_ZVAL_PTR(&EX_T(opline->result.var));
12821271
}
1272+
FREE_OP2();
1273+
FREE_OP1_VAR_PTR();
12831274
} else {
1275+
zval *container;
1276+
12841277
if (OP2_TYPE == IS_UNUSED) {
12851278
zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
12861279
}
1287-
container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_R);
1280+
container = GET_OP1_ZVAL_PTR(BP_VAR_R);
12881281
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);
1282+
FREE_OP2();
1283+
FREE_OP1();
12891284
}
1290-
FREE_OP2();
1291-
FREE_OP1_VAR_PTR();
12921285
CHECK_EXCEPTION();
12931286
ZEND_VM_NEXT_OPCODE();
12941287
}

0 commit comments

Comments
 (0)