if (zend_hash_index_find(Z_ARRVAL_PP(data), 0, (void**)&value) == SUCCESS &&
Z_TYPE_PP(value) == IS_STRING) {
zval **tmp;
- if (zend_hash_index_find(Z_ARRVAL_PP(data), 1, (void**)&tmp) == SUCCESS &&
- strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_PP(tmp),Z_STRLEN_PP(tmp)) == 0 &&
- zend_hash_index_find(Z_ARRVAL_PP(data), 2, (void**)&tmp) == SUCCESS &&
- in_domain(phpurl->host,Z_STRVAL_PP(tmp)) &&
+ if ((zend_hash_index_find(Z_ARRVAL_PP(data), 1, (void**)&tmp) == FAILURE ||
+ strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_PP(tmp),Z_STRLEN_PP(tmp)) == 0) &&
+ (zend_hash_index_find(Z_ARRVAL_PP(data), 2, (void**)&tmp) == FAILURE ||
+ in_domain(phpurl->host,Z_STRVAL_PP(tmp))) &&
(use_ssl || zend_hash_index_find(Z_ARRVAL_PP(data), 3, (void**)&tmp) == FAILURE)) {
smart_str_appendl(&soap_headers, key, strlen(key));
smart_str_appendc(&soap_headers, '=');
PHP_METHOD(SoapClient, __getFunctions);
PHP_METHOD(SoapClient, __getTypes);
PHP_METHOD(SoapClient, __doRequest);
+PHP_METHOD(SoapClient, __setCookie);
/* SoapVar Functions */
PHP_METHOD(SoapVar, SoapVar);
PHP_ME(SoapClient, __getFunctions, NULL, 0)
PHP_ME(SoapClient, __getTypes, NULL, 0)
PHP_ME(SoapClient, __doRequest, NULL, 0)
+ PHP_ME(SoapClient, __setCookie, NULL, 0)
{NULL, NULL, NULL}
};
}
/* }}} */
+/* {{{ proto void SoapClient::__setCookie(string name [, strung value])
+ Sets cookie thet will sent with SOAP request.
+ The call to this function will effect all folowing calls of SOAP methods.
+ If value is not specified cookie is removed. */
+PHP_METHOD(SoapClient, __setCookie)
+{
+ char *name;
+ char *val = NULL;
+ int name_len, val_len;
+ zval **cookies;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s",
+ &name, &name_len, &val, &val_len) == FAILURE) {
+ RETURN_NULL();
+ }
+
+ if (val == NULL) {
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS) {
+ zend_hash_del(Z_ARRVAL_PP(cookies), name, name_len+1);
+ }
+ } else {
+ zval *zcookie;
+
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE) {
+ zval *tmp_cookies;
+
+ MAKE_STD_ZVAL(tmp_cookies);
+ array_init(tmp_cookies);
+ zend_hash_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), &tmp_cookies, sizeof(zval *), (void **)&cookies);
+ }
+
+ ALLOC_INIT_ZVAL(zcookie);
+ array_init(zcookie);
+ add_index_stringl(zcookie, 0, val, val_len, 1);
+ add_assoc_zval_ex(*cookies, name, name_len+1, zcookie);
+ }
+}
+/* }}} */
+
#ifndef ZEND_ENGINE_2
static void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
{