php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch 0001-Fix-SOAP-wsdl-cache-failing-to-look-at-mem_cache.patch for SOAP related Bug #63271

Patch version 2012-10-13 05:47 UTC

Return to Bug #63271 | Download this patch
Patch Revisions:

Developer: jawed@php.net

From 9bfd16c2d426390f4ff9e2023e20ce48b2726454 Mon Sep 17 00:00:00 2001
From: "John (JJ) Jawed" <jawed@php.net>
Date: Fri, 12 Oct 2012 22:41:41 -0700
Subject: [PATCH] Fix SOAP wsdl cache failing to look at mem_cache

---
 ext/soap/php_soap.h |    3 +++
 ext/soap/soap.c     |   42 ++++--------------------------------------
 2 files changed, 7 insertions(+), 38 deletions(-)

diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index 37edec7..424aec0 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -207,4 +207,7 @@ zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *faul
 #define soap_error3(severity, format, param1, param2, param3) \
 	php_error(severity, "SOAP-ERROR: " format, param1, param2, param3)
 
+#define soap_cache_enabled() \
+	SOAP_GLOBAL(cache_enabled) ? SOAP_GLOBAL(cache_mode) : 0
+
 #endif
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index abeab53..5f1bb3d 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -463,48 +463,14 @@ zend_module_entry soap_module_entry = {
 ZEND_GET_MODULE(soap)
 #endif
 
-ZEND_INI_MH(OnUpdateCacheEnabled)
-{
-	if (OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
-		return FAILURE;
-	}
-	if (SOAP_GLOBAL(cache_enabled)) {
-		SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode);
-	} else {
-		SOAP_GLOBAL(cache) = 0;
-	}
-	return SUCCESS;
-}
-
-ZEND_INI_MH(OnUpdateCacheMode)
-{
-	char *p;
-#ifndef ZTS
-	char *base = (char *) mh_arg2;
-#else
-	char *base = (char *) ts_resource(*((int *) mh_arg2));
-#endif
-
-	p = (char*) (base+(size_t) mh_arg1);
-
-	*p = (char)atoi(new_value);
-
-	if (SOAP_GLOBAL(cache_enabled)) {
-		SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode);
-	} else {
-		SOAP_GLOBAL(cache) = 0;
-	}
-	return SUCCESS;
-}
-
 PHP_INI_BEGIN()
-STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled",     "1", PHP_INI_ALL, OnUpdateCacheEnabled,
+STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled",     "1", PHP_INI_ALL, OnUpdateLong,
                   cache_enabled, zend_soap_globals, soap_globals)
 STD_PHP_INI_ENTRY("soap.wsdl_cache_dir",         "/tmp", PHP_INI_ALL, OnUpdateString,
                   cache_dir, zend_soap_globals, soap_globals)
 STD_PHP_INI_ENTRY("soap.wsdl_cache_ttl",         "86400", PHP_INI_ALL, OnUpdateLong,
                   cache_ttl, zend_soap_globals, soap_globals)
-STD_PHP_INI_ENTRY("soap.wsdl_cache",             "1", PHP_INI_ALL, OnUpdateCacheMode,
+STD_PHP_INI_ENTRY("soap.wsdl_cache",             "1", PHP_INI_ALL, OnUpdateLong,
                   cache_mode, zend_soap_globals, soap_globals)
 STD_PHP_INI_ENTRY("soap.wsdl_cache_limit",       "5", PHP_INI_ALL, OnUpdateLong,
                   cache_limit, zend_soap_globals, soap_globals)
@@ -1102,7 +1068,7 @@ PHP_METHOD(SoapServer, SoapServer)
 	memset(service, 0, sizeof(soapService));
 	service->send_errors = 1;
 
-	cache_wsdl = SOAP_GLOBAL(cache);
+	cache_wsdl = SOAP_CACHE_ENABLED();
 
 	if (options != NULL) {
 		HashTable *ht = Z_ARRVAL_P(options);
@@ -2318,7 +2284,7 @@ PHP_METHOD(SoapClient, SoapClient)
 		php_error_docref(NULL TSRMLS_CC, E_ERROR, "$wsdl must be string or null");
 	}
 
-	cache_wsdl = SOAP_GLOBAL(cache);
+	cache_wsdl = SOAP_CACHE_ENABLED();
 
 	if (options != NULL) {
 		HashTable *ht = Z_ARRVAL_P(options);
-- 
1.7.9.5

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 06 08:01:28 2024 UTC