Fix bug #60169 Conjunction of ternary and list crashes PHP

This commit is contained in:
Xinchen Hui 2011-11-03 03:59:41 +00:00
parent c60a2a711a
commit a9dbbf6dea
3 changed files with 20 additions and 22 deletions

View File

@ -1,7 +1,5 @@
--TEST--
Bug #60169 (Conjunction of ternary and list crashes PHP)
--XFAIL--
See Bug #60169, doesn't fixed yet
--FILE--
<?php
error_reporting(0);

View File

@ -4689,12 +4689,12 @@ ZEND_VM_HANDLER(158, ZEND_JMP_SET_VAR, CONST|TMP|VAR|CV, ANY)
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!IS_OP1_TMP_FREE()) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}
@ -4741,12 +4741,12 @@ ZEND_VM_HANDLER(157, ZEND_QM_ASSIGN_VAR, CONST|TMP|VAR|CV, ANY)
if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!IS_OP1_TMP_FREE()) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}

View File

@ -2863,12 +2863,12 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLE
if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!0) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}
@ -2914,12 +2914,12 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!0) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}
@ -7223,12 +7223,12 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_
if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!1) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}
@ -7275,12 +7275,12 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!1) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}
@ -11694,12 +11694,12 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!0) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}
@ -11746,12 +11746,12 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!0) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}
@ -27346,12 +27346,12 @@ static int ZEND_FASTCALL ZEND_JMP_SET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_A
if (IS_CV == IS_VAR || IS_CV == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!0) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}
@ -27397,12 +27397,12 @@ static int ZEND_FASTCALL ZEND_QM_ASSIGN_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
if (IS_CV == IS_VAR || IS_CV == IS_CV) {
Z_ADDREF_P(value);
EX_T(opline->result.var).var.ptr = value;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
} else {
ALLOC_ZVAL(ret);
INIT_PZVAL_COPY(ret, value);
EX_T(opline->result.var).var.ptr = ret;
EX_T(opline->result.var).var.ptr_ptr = NULL;
EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr;
if (!0) {
zval_copy_ctor(EX_T(opline->result.var).var.ptr);
}