Skip to content

Commit 3f2c8d3

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: Increase WSDL cache version (7.0 wsdl cache is incomatible with PHP-5) Include WSDL cache version number into file name
2 parents 8f8fb92 + 508d78c commit 3f2c8d3

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

ext/soap/php_sdl.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
11741174
return ctx.sdl;
11751175
}
11761176

1177-
#define WSDL_CACHE_VERSION 0x0e
1177+
#define WSDL_CACHE_VERSION 0x0f
11781178

11791179
#define WSDL_CACHE_GET(ret,type,buf) memcpy(&ret,*buf,sizeof(type)); *buf += sizeof(type);
11801180
#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)
32043204
PHP_MD5Update(&context, (unsigned char*)uri, uri_len);
32053205
PHP_MD5Final(digest, &context);
32063206
make_digest(md5str, digest);
3207-
key = emalloc(len+sizeof("/wsdl-")-1+user_len+sizeof(md5str));
3207+
key = emalloc(len+sizeof("/wsdl-")-1+user_len+2+sizeof(md5str));
32083208
memcpy(key,SOAP_GLOBAL(cache_dir),len);
32093209
memcpy(key+len,"/wsdl-",sizeof("/wsdl-")-1);
32103210
len += sizeof("/wsdl-")-1;
@@ -3213,6 +3213,17 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
32133213
len += user_len-1;
32143214
key[len++] = '-';
32153215
}
3216+
key[len++] = '-';
3217+
if (WSDL_CACHE_VERSION <= 0x9f) {
3218+
key[len++] = (WSDL_CACHE_VERSION >> 8) + '0';
3219+
} else {
3220+
key[len++] = (WSDL_CACHE_VERSION >> 8) - 10 + 'a';
3221+
}
3222+
if ((WSDL_CACHE_VERSION & 0xf) <= 0x9) {
3223+
key[len++] = (WSDL_CACHE_VERSION & 0xf) + '0';
3224+
} else {
3225+
key[len++] = (WSDL_CACHE_VERSION & 0xf) - 10 + 'a';
3226+
}
32163227
memcpy(key+len,md5str,sizeof(md5str));
32173228

32183229
if ((sdl = get_sdl_from_cache(key, uri, t-SOAP_GLOBAL(cache_ttl), &cached)) != NULL) {

0 commit comments

Comments
 (0)