Removed a hack that allowed passing of function return value by reference depending on value of reference-counter (Fixed Zend/tests/bug35393.phpt test failure)

This commit is contained in:
Dmitry Stogov 2014-08-20 15:04:40 +04:00
parent 3d90fdf79c
commit 04aa96d28d
2 changed files with 3 additions and 12 deletions

View File

@ -3077,10 +3077,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
(Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) && (Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) &&
((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) || (Z_ISREF_P(varptr) || Z_TYPE_P(varptr) == IS_OBJECT)) {
Z_ISREF_P(varptr) ||
Z_TYPE_P(varptr) == IS_OBJECT ||
(Z_REFCOUNTED_P(varptr) && Z_REFCOUNT_P(varptr) == 1))) {
ZVAL_MAKE_REF(varptr); ZVAL_MAKE_REF(varptr);
if (OP1_TYPE == IS_CV) { if (OP1_TYPE == IS_CV) {

View File

@ -13554,10 +13554,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC);
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
(Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) && (Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) &&
((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) || (Z_ISREF_P(varptr) || Z_TYPE_P(varptr) == IS_OBJECT)) {
Z_ISREF_P(varptr) ||
Z_TYPE_P(varptr) == IS_OBJECT ||
(Z_REFCOUNTED_P(varptr) && Z_REFCOUNT_P(varptr) == 1))) {
ZVAL_MAKE_REF(varptr); ZVAL_MAKE_REF(varptr);
if (IS_VAR == IS_CV) { if (IS_VAR == IS_CV) {
@ -30934,10 +30931,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC);
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
(Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) && (Z_VAR_FLAGS_P(varptr) & IS_VAR_RET_REF)) &&
((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) || (Z_ISREF_P(varptr) || Z_TYPE_P(varptr) == IS_OBJECT)) {
Z_ISREF_P(varptr) ||
Z_TYPE_P(varptr) == IS_OBJECT ||
(Z_REFCOUNTED_P(varptr) && Z_REFCOUNT_P(varptr) == 1))) {
ZVAL_MAKE_REF(varptr); ZVAL_MAKE_REF(varptr);
if (IS_CV == IS_CV) { if (IS_CV == IS_CV) {