]> granicus.if.org Git - php/commitdiff
Merge branch 'bug64023' into PHP-5.4
authorGustavo Lopes <glopes@nebm.ist.utl.pt>
Tue, 22 Jan 2013 11:24:33 +0000 (12:24 +0100)
committerGustavo Lopes <glopes@nebm.ist.utl.pt>
Tue, 22 Jan 2013 11:24:33 +0000 (12:24 +0100)
* bug64023:
  Fix bug #64023 (__toString() & SplFileInfo)

Conflicts:
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

1  2 
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/spl/spl_directory.c

index b7fa9070732e5c139e3f7be7da2009e1775be05f,e8d3250d0d930abcda28712573e41dcee3b2c0d5..e5cdd1d1fbd287a067dafe8cd790fec39876b9e0
@@@ -972,32 -894,16 +972,20 @@@ ZEND_VM_HANDLER(37, ZEND_POST_DEC, VAR|
  
  ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMP|VAR|CV, ANY)
  {
 -      zend_op *opline = EX(opline);
 +      USE_OPLINE
        zend_free_op free_op1;
-       zval z_copy;
 -      zval *z = GET_OP1_ZVAL_PTR(BP_VAR_R);
 +      zval *z;
 +
 +      SAVE_OPLINE();
 +      z = GET_OP1_ZVAL_PTR(BP_VAR_R);
  
-       if (OP1_TYPE != IS_CONST &&
-           UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) &&
-           Z_OBJ_HT_P(z)->get_method != NULL) {
-           if (OP1_TYPE == IS_TMP_VAR) {
-               INIT_PZVAL(z);
-           }
-               if (zend_std_cast_object_tostring(z, &z_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
-                       zend_print_variable(&z_copy);
-                       zval_dtor(&z_copy);
-               } else {
-                       zend_print_variable(z);
-               }
-       } else {
-               zend_print_variable(z);
+       if (OP1_TYPE == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
+               INIT_PZVAL(z);
        }
+       zend_print_variable(z);
  
        FREE_OP1();
 +      CHECK_EXCEPTION();
        ZEND_VM_NEXT_OPCODE();
  }
  
index 2680d8524295386ed452b21c5977dc3410db3b7e,f5cedd872f41753280326ecf88a0345ac61b6594..97e5a8e93fd05eab8139917b7b6430c25d6e8318
@@@ -2022,31 -1318,15 +2022,19 @@@ static int ZEND_FASTCALL  ZEND_BOOL_NOT
  
  static int ZEND_FASTCALL  ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
  {
 -      zend_op *opline = EX(opline);
 +      USE_OPLINE
 +
-       zval z_copy;
 +      zval *z;
  
 -      zval *z = &opline->op1.u.constant;
 +      SAVE_OPLINE();
 +      z = opline->op1.zv;
  
-       if (IS_CONST != IS_CONST &&
-           UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) &&
-           Z_OBJ_HT_P(z)->get_method != NULL) {
-           if (IS_CONST == IS_TMP_VAR) {
-               INIT_PZVAL(z);
-           }
-               if (zend_std_cast_object_tostring(z, &z_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
-                       zend_print_variable(&z_copy);
-                       zval_dtor(&z_copy);
-               } else {
-                       zend_print_variable(z);
-               }
-       } else {
-               zend_print_variable(z);
+       if (IS_CONST == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
+               INIT_PZVAL(z);
        }
+       zend_print_variable(z);
  
 +      CHECK_EXCEPTION();
        ZEND_VM_NEXT_OPCODE();
  }
  
@@@ -6441,32 -4622,16 +6429,20 @@@ static int ZEND_FASTCALL  ZEND_BOOL_NOT
  
  static int ZEND_FASTCALL  ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
  {
 -      zend_op *opline = EX(opline);
 +      USE_OPLINE
        zend_free_op free_op1;
-       zval z_copy;
 -      zval *z = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
 +      zval *z;
 +
 +      SAVE_OPLINE();
 +      z = _get_zval_ptr_tmp(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
  
-       if (IS_TMP_VAR != IS_CONST &&
-           UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) &&
-           Z_OBJ_HT_P(z)->get_method != NULL) {
-           if (IS_TMP_VAR == IS_TMP_VAR) {
-               INIT_PZVAL(z);
-           }
-               if (zend_std_cast_object_tostring(z, &z_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
-                       zend_print_variable(&z_copy);
-                       zval_dtor(&z_copy);
-               } else {
-                       zend_print_variable(z);
-               }
-       } else {
-               zend_print_variable(z);
+       if (IS_TMP_VAR == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
+               INIT_PZVAL(z);
        }
+       zend_print_variable(z);
  
        zval_dtor(free_op1.var);
 +      CHECK_EXCEPTION();
        ZEND_VM_NEXT_OPCODE();
  }
  
@@@ -10759,32 -7874,16 +10735,20 @@@ static int ZEND_FASTCALL  ZEND_POST_DEC
  
  static int ZEND_FASTCALL  ZEND_ECHO_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
  {
 -      zend_op *opline = EX(opline);
 +      USE_OPLINE
        zend_free_op free_op1;
-       zval z_copy;
 -      zval *z = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
 +      zval *z;
 +
 +      SAVE_OPLINE();
 +      z = _get_zval_ptr_var(opline->op1.var, EX_Ts(), &free_op1 TSRMLS_CC);
  
-       if (IS_VAR != IS_CONST &&
-           UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) &&
-           Z_OBJ_HT_P(z)->get_method != NULL) {
-           if (IS_VAR == IS_TMP_VAR) {
-               INIT_PZVAL(z);
-           }
-               if (zend_std_cast_object_tostring(z, &z_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
-                       zend_print_variable(&z_copy);
-                       zval_dtor(&z_copy);
-               } else {
-                       zend_print_variable(z);
-               }
-       } else {
-               zend_print_variable(z);
+       if (IS_VAR == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
+               INIT_PZVAL(z);
        }
+       zend_print_variable(z);
  
        if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
 +      CHECK_EXCEPTION();
        ZEND_VM_NEXT_OPCODE();
  }
  
@@@ -26737,42 -21912,34 +26701,30 @@@ static int ZEND_FASTCALL  ZEND_POST_DEC
        ZEND_VM_NEXT_OPCODE();
  }
  
 -static int ZEND_FASTCALL  ZEND_FETCH_R_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 +static int ZEND_FASTCALL  ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
  {
 -      return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
 -}
 +      USE_OPLINE
  
-       zval z_copy;
 -static int ZEND_FASTCALL  ZEND_FETCH_W_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 -{
 -      return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_W, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
 -}
 +      zval *z;
  
 -static int ZEND_FASTCALL  ZEND_FETCH_RW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 -{
 -      return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_RW, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
 -}
 +      SAVE_OPLINE();
 +      z = _get_zval_ptr_cv_BP_VAR_R(EX_CVs(), opline->op1.var TSRMLS_CC);
  
-       if (IS_CV != IS_CONST &&
-           UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) &&
-           Z_OBJ_HT_P(z)->get_method != NULL) {
-           if (IS_CV == IS_TMP_VAR) {
-               INIT_PZVAL(z);
-           }
-               if (zend_std_cast_object_tostring(z, &z_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
-                       zend_print_variable(&z_copy);
-                       zval_dtor(&z_copy);
-               } else {
-                       zend_print_variable(z);
-               }
-       } else {
-               zend_print_variable(z);
 -static int ZEND_FASTCALL  ZEND_FETCH_FUNC_ARG_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 -{
 -      return zend_fetch_var_address_helper_SPEC_CV(ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), EX(opline)->extended_value)?BP_VAR_W:BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
 -}
++      if (IS_CV == IS_TMP_VAR && Z_TYPE_P(z) == IS_OBJECT) {
++              INIT_PZVAL(z);
 +      }
++      zend_print_variable(z);
  
 -static int ZEND_FASTCALL  ZEND_FETCH_UNSET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 -{
 -      return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_UNSET, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
 +      CHECK_EXCEPTION();
 +      ZEND_VM_NEXT_OPCODE();
  }
  
 -static int ZEND_FASTCALL  ZEND_FETCH_IS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 +static int ZEND_FASTCALL  ZEND_PRINT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
  {
 -      return zend_fetch_var_address_helper_SPEC_CV(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
 +      USE_OPLINE
 +
 +      ZVAL_LONG(&EX_T(opline->result.var).tmp_var, 1);
 +      return ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
  }
  
  static int ZEND_FASTCALL  ZEND_JMPZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
Simple merge