summaryrefslogtreecommitdiff
path: root/ext/soap
diff options
context:
space:
mode:
Diffstat (limited to 'ext/soap')
-rw-r--r--ext/soap/php_http.c4
-rw-r--r--ext/soap/soap.c14
-rw-r--r--ext/soap/tests/bug68996.phpt45
3 files changed, 54 insertions, 9 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 4d53888487..db0e3c14ca 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -471,7 +471,7 @@ try_again:
if (stream != NULL) {
php_url *orig;
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1)) != NULL &&
- (orig = (php_url *) zend_fetch_resource(tmp, -1, "httpurl", NULL, 1, le_url)) != NULL &&
+ (orig = (php_url *) zend_fetch_resource_ex(tmp, "httpurl", le_url)) != NULL &&
((use_proxy && !use_ssl) ||
(((use_ssl && orig->scheme != NULL && strcmp(orig->scheme, "https") == 0) ||
(!use_ssl && orig->scheme == NULL) ||
@@ -517,7 +517,7 @@ try_again:
if (stream) {
zval *cookies, *login, *password;
- zend_resource *ret = zend_register_resource(NULL, phpurl, le_url);
+ zend_resource *ret = zend_register_resource(phpurl, le_url);
add_property_resource(this_ptr, "httpurl", ret);
/*zend_list_addref(ret);*/
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index a993b2ef8c..4308f3885f 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -139,16 +139,16 @@ static void soap_error_handler(int error_num, const char *error_filename, const
}
#define FIND_SDL_PROPERTY(ss,tmp) (tmp = zend_hash_str_find(Z_OBJPROP_P(ss), "sdl", sizeof("sdl")-1))
-#define FETCH_SDL_RES(ss,tmp) ss = (sdlPtr) zend_fetch_resource(tmp, -1, "sdl", NULL, 1, le_sdl)
+#define FETCH_SDL_RES(ss,tmp) ss = (sdlPtr) zend_fetch_resource_ex(tmp, "sdl", le_sdl)
#define FIND_TYPEMAP_PROPERTY(ss,tmp) (tmp = zend_hash_str_find(Z_OBJPROP_P(ss), "typemap", sizeof("typemap")-1))
-#define FETCH_TYPEMAP_RES(ss,tmp) ss = (HashTable*) zend_fetch_resource(tmp, -1, "typemap", NULL, 1, le_typemap)
+#define FETCH_TYPEMAP_RES(ss,tmp) ss = (HashTable*) zend_fetch_resource_ex(tmp, "typemap", le_typemap)
#define FETCH_THIS_SERVICE(ss) \
{ \
zval *tmp; \
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()),"service", sizeof("service")-1)) != NULL) { \
- ss = (soapServicePtr)zend_fetch_resource(tmp, -1, "service", NULL, 1, le_service); \
+ ss = (soapServicePtr)zend_fetch_resource_ex(tmp, "service", le_service); \
} else { \
php_error_docref(NULL, E_WARNING, "Can not fetch service object"); \
SOAP_SERVER_END_CODE(); \
@@ -1245,7 +1245,7 @@ PHP_METHOD(SoapServer, SoapServer)
service->typemap = soap_create_typemap(service->sdl, typemap_ht);
}
- res = zend_register_resource(NULL, service, le_service);
+ res = zend_register_resource(service, le_service);
add_property_resource(getThis(), "service", res);
SOAP_SERVER_END_CODE();
@@ -2252,7 +2252,7 @@ static void soap_error_handler(int error_num, const char *error_filename, const
if (Z_OBJ(SOAP_GLOBAL(error_object)) &&
instanceof_function(Z_OBJCE(SOAP_GLOBAL(error_object)), soap_server_class_entry) &&
(tmp = zend_hash_str_find(Z_OBJPROP(SOAP_GLOBAL(error_object)), "service", sizeof("service")-1)) != NULL &&
- (service = (soapServicePtr)zend_fetch_resource(tmp, -1, "service", NULL, 1, le_service)) &&
+ (service = (soapServicePtr)zend_fetch_resource_ex(tmp, "service", le_service)) &&
!service->send_errors) {
strcpy(buffer, "Internal Error");
} else {
@@ -2547,7 +2547,7 @@ PHP_METHOD(SoapClient, SoapClient)
SOAP_GLOBAL(soap_version) = soap_version;
sdl = get_sdl(this_ptr, Z_STRVAL_P(wsdl), cache_wsdl);
- res = zend_register_resource(NULL, sdl, le_sdl);
+ res = zend_register_resource(sdl, le_sdl);
add_property_resource(this_ptr, "sdl", res);
@@ -2559,7 +2559,7 @@ PHP_METHOD(SoapClient, SoapClient)
if (typemap) {
zend_resource *res;
- res = zend_register_resource(NULL, typemap, le_typemap);
+ res = zend_register_resource(typemap, le_typemap);
add_property_resource(this_ptr, "typemap", res);
}
}
diff --git a/ext/soap/tests/bug68996.phpt b/ext/soap/tests/bug68996.phpt
new file mode 100644
index 0000000000..e503d80239
--- /dev/null
+++ b/ext/soap/tests/bug68996.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #68996 (Invalid free of CG(interned_empty_string))
+--SKIPIF--
+<?php
+if (getenv("USE_ZEND_ALLOC") !== "0")
+ print "skip Need Zend MM disabled";
+?>
+--FILE--
+<?php
+$s = new SoapServer(NULL, [
+ 'uri' => 'http://foo',
+]);
+
+function foo() {
+ return new SoapFault("\xfc\x63", "some msg");
+}
+$s->addFunction("foo");
+
+// soap 1.1
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <SOAP-ENV:foo />
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+EOF;
+$s->handle($HTTP_RAW_POST_DATA);
+
+// soap 1.2
+$HTTP_RAW_POST_DATA = <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+ <env:Body>
+ <env:foo />
+ </env:Body>
+</env:Envelope>
+EOF;
+$s->handle($HTTP_RAW_POST_DATA);
+?>
+--EXPECTF--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode></faultcode><faultstring>some msg</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value></env:Value></env:Code><env:Reason><env:Text>some msg</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>