com php-src: Increase WSDL cache version (7.0 wsdl cache is incomatible with PHP-5) Include WSDL cache version number into file name: ext/soap/php_sdl.c

[email protected] (Dmitry Stogov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    bd7e5c1548fb9fa5c40446c9fc89e1b086eba312
Author:    Dmitry Stogov <[email protected]>         Tue, 21 Feb 2017 10:41:20 +0300
Parents:   c836ad1c7eac2a142cc334ea9cf9975bcd0d6f77
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=bd7e5c1548fb9fa5c40446c9fc89e1b086eba312

Log:
Increase WSDL cache version (7.0 wsdl cache is incomatible with PHP-5)
Include WSDL cache version number into file name

Changed paths:
  M  ext/soap/php_sdl.c


Diff:
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 9b46984..fa5706f 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -1174,7 +1174,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
 	return ctx.sdl;
 }
 
-#define WSDL_CACHE_VERSION 0x0e
+#define WSDL_CACHE_VERSION 0x0f
 
 #define WSDL_CACHE_GET(ret,type,buf)   memcpy(&ret,*buf,sizeof(type)); *buf += sizeof(type);
 #define WSDL_CACHE_GET_INT(ret,buf)    ret = ((unsigned char)(*buf)[0])|((unsigned char)(*buf)[1]<<8)|((unsigned char)(*buf)[2]<<16)|((int)(*buf)[3]<<24); *buf += 4;
@@ -3204,7 +3204,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
 		PHP_MD5Update(&context, (unsigned char*)uri, uri_len);
 		PHP_MD5Final(digest, &context);
 		make_digest(md5str, digest);
-		key = emalloc(len+sizeof("/wsdl-")-1+user_len+sizeof(md5str));
+		key = emalloc(len+sizeof("/wsdl-")-1+user_len+2+sizeof(md5str));
 		memcpy(key,SOAP_GLOBAL(cache_dir),len);
 		memcpy(key+len,"/wsdl-",sizeof("/wsdl-")-1);
 		len += sizeof("/wsdl-")-1;
@@ -3213,6 +3213,17 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
 			len += user_len-1;
 			key[len++] = '-';
 		}
+		key[len++] = '-';
+		if (WSDL_CACHE_VERSION <= 0x9f) {
+			key[len++] = (WSDL_CACHE_VERSION >> 8) + '0';
+		} else {
+			key[len++] = (WSDL_CACHE_VERSION >> 8) - 10 + 'a';
+		}
+		if ((WSDL_CACHE_VERSION & 0xf) <= 0x9) {
+			key[len++] = (WSDL_CACHE_VERSION & 0xf) + '0';
+		} else {
+			key[len++] = (WSDL_CACHE_VERSION & 0xf) - 10 + 'a';
+		}
 		memcpy(key+len,md5str,sizeof(md5str));
 
 		if ((sdl = get_sdl_from_cache(key, uri, t-SOAP_GLOBAL(cache_ttl), &cached)) != NULL) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.