]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6'
authorXinchen Hui <laruence@php.net>
Fri, 27 Feb 2015 15:35:37 +0000 (23:35 +0800)
committerXinchen Hui <laruence@php.net>
Fri, 27 Feb 2015 15:35:37 +0000 (23:35 +0800)
Conflicts:
ext/soap/soap.c

1  2 
ext/soap/soap.c

diff --cc ext/soap/soap.c
index 63de00049b3e49c066578d91d693c812d7230033,6f56216aa31f15e1c9c5d918dd3e57fcb9c597a3..3a27f7a7b4c5eb9b0d070d7f42de154c0fefb583
@@@ -2580,39 -2562,45 +2580,39 @@@ static int do_request(zval *this_ptr, x
                return FALSE;
        }
  
 -      if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
 -          Z_TYPE_PP(trace) == IS_LONG && Z_LVAL_PP(trace) > 0) {
 -              add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1);
 +      if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
-           Z_LVAL_P(trace) > 0) {
++          Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) > 0) {
 +              add_property_stringl(this_ptr, "__last_request", buf, buf_size);
        }
  
 -      INIT_ZVAL(func);
 -      ZVAL_STRINGL(&func,"__doRequest",sizeof("__doRequest")-1,0);
 -      ALLOC_INIT_ZVAL(params[0]);
 -      ZVAL_STRINGL(params[0], buf, buf_size, 1);
 -      ALLOC_INIT_ZVAL(params[1]);
 +      ZVAL_STRINGL(&func,"__doRequest",sizeof("__doRequest")-1);
 +      ZVAL_STRINGL(&params[0], buf, buf_size);
        if (location == NULL) {
 -              ZVAL_NULL(params[1]);
 +              ZVAL_NULL(&params[1]);
        } else {
 -              ZVAL_STRING(params[1], location, 1);
 +              ZVAL_STRING(&params[1], location);
        }
 -      ALLOC_INIT_ZVAL(params[2]);
        if (action == NULL) {
 -              ZVAL_NULL(params[2]);
 +              ZVAL_NULL(&params[2]);
        } else {
 -              ZVAL_STRING(params[2], action, 1);
 +              ZVAL_STRING(&params[2], action);
        }
 -      ALLOC_INIT_ZVAL(params[3]);
 -      ZVAL_LONG(params[3], version);
 +      ZVAL_LONG(&params[3], version);
 +      ZVAL_LONG(&params[4], one_way);
  
 -      ALLOC_INIT_ZVAL(params[4]);
 -      ZVAL_LONG(params[4], one_way);
 -
 -      if (call_user_function(NULL, &this_ptr, &func, response, 5, params TSRMLS_CC) != SUCCESS) {
 -              add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL TSRMLS_CC);
 +      if (call_user_function(NULL, this_ptr, &func, response, 5, params) != SUCCESS) {
 +              add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL);
                ret = FALSE;
        } else if (Z_TYPE_P(response) != IS_STRING) {
 -              if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == FAILURE) {
 -                      add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() returned non string value", NULL, NULL TSRMLS_CC);
 +              if ((fault = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault")-1)) == NULL) {
 +                      add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() returned non string value", NULL, NULL);
                }
                ret = FALSE;
 -      } else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
 -          Z_TYPE_PP(trace) == IS_LONG && Z_LVAL_PP(trace) > 0) {
 -              add_property_stringl(this_ptr, "__last_response", Z_STRVAL_P(response), Z_STRLEN_P(response), 1);
 +      } else if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
-           Z_LVAL_P(trace) > 0) {
++          Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) > 0) {
 +              add_property_str(this_ptr, "__last_response", zend_string_copy(Z_STR_P(response)));
        }
 +      zval_ptr_dtor(&func);
        zval_ptr_dtor(&params[4]);
        zval_ptr_dtor(&params[3]);
        zval_ptr_dtor(&params[2]);
@@@ -2908,20 -2903,24 +2908,20 @@@ PHP_METHOD(SoapClient, __call
        }
  
        /* Add default headers */
 -      if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers"), (void **) &tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_ARRAY) {
 -              HashTable *default_headers = Z_ARRVAL_P(*tmp);
 +      this_ptr = getThis();
-       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1)) != NULL) {
++      if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1)) != NULL && Z_TYPE_P(tmp) == IS_ARRAY) {
 +              HashTable *default_headers = Z_ARRVAL_P(tmp);
                if (soap_headers) {
                        if (!free_soap_headers) {
 -                              HashTable *t =  emalloc(sizeof(HashTable));
 -                              zend_hash_init(t, 0, NULL, ZVAL_PTR_DTOR, 0);
 -                              zend_hash_copy(t, soap_headers, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
 -                              soap_headers = t;
 +                              soap_headers = zend_array_dup(soap_headers);
                                free_soap_headers = 1;
                        }
 -                      zend_hash_internal_pointer_reset(default_headers);
 -                      while (zend_hash_get_current_data(default_headers, (void**)&tmp) == SUCCESS) {
 -                              Z_ADDREF_PP(tmp);
 -                              zend_hash_next_index_insert(soap_headers, tmp, sizeof(zval *), NULL);
 -                              zend_hash_move_forward(default_headers);
 -                      }
 +                      ZEND_HASH_FOREACH_VAL(default_headers, tmp) {
 +                              Z_ADDREF_P(tmp);
 +                              zend_hash_next_index_insert(soap_headers, tmp);
 +                      } ZEND_HASH_FOREACH_END();
                } else {
 -                      soap_headers = Z_ARRVAL_P(*tmp);
 +                      soap_headers = Z_ARRVAL_P(tmp);
                        free_soap_headers = 0;
                }
        }