Fixed possible SIGSEGV (Rob Richards)
authorDmitry Stogov <dmitry@php.net>
Fri, 9 Dec 2005 15:29:15 +0000 (15:29 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 9 Dec 2005 15:29:15 +0000 (15:29 +0000)
ext/soap/php_encoding.c
ext/soap/php_schema.c
ext/soap/php_sdl.c
ext/soap/soap.c

index 1162a417cb525b2f8d0828138922d09c3dadf086..559fd75c7b6f75c8bb7619cbacea817071bc6e61 100644 (file)
@@ -268,7 +268,7 @@ xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr par
                                if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) {
                                  enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
                                } else {
-                                 enc = get_encoder(SOAP_GLOBAL(sdl), NULL, Z_STRVAL_PP(zstype));
+                                 enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_PP(zstype), Z_STRLEN_PP(zstype));
                                }
                        }
                }
index 565a7fb46b01da4abc9fd6ca78f6d83b68cb4492..0e6fb57a5b5e3f66313c575fd0cee387dee5d9b0 100644 (file)
@@ -232,7 +232,11 @@ int load_schema(sdlCtx *ctx, xmlNodePtr schema TSRMLS_DC)
                        location = get_attribute(trav->properties, "schemaLocation");
 
                        if (ns != NULL && tns != NULL && strcmp(ns->children->content,tns->children->content) == 0) {
-                               soap_error1(E_ERROR, "Parsing Schema: can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace'", location->children->content);
+                               if (location) {
+                                       soap_error1(E_ERROR, "Parsing Schema: can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace'", location->children->content);
+                               } else {
+                                       soap_error0(E_ERROR, "Parsing Schema: can't import schema. Namespace must not match the enclosing schema 'targetNamespace'");
+                               }
                        }
                        if (location) {
                                xmlChar *base = xmlNodeGetBase(trav->doc, trav);
index 34d34e199e98b6cc535e5ba144d0730dae79ee34..bf0853ea7a509aa6f5f4985c4d6189fd276db85c 100644 (file)
@@ -410,10 +410,10 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml
                                if (!h->ns && h->element->namens) {
                                        h->ns = estrdup(h->element->namens);
                                }
-                       }
-                       if (h->element->name) {
-                               efree(h->name);
-                               h->name = estrdup(h->element->name);
+                               if (h->element->name) {
+                                       efree(h->name);
+                                       h->name = estrdup(h->element->name);
+                               }
                        }
                }
        }
index a339f46716ccee1033b9e15d28c58a4bac56cd7c..9edcc7e5e0060bf5d47dbbf948d0b186904f72cb 100644 (file)
@@ -1108,7 +1108,7 @@ PHP_FUNCTION(PHP_SOAP_SERVER_CLASS, map)
 #endif
 
 
-/* {{{ proto object SoapServer::SoapServer ( mixed wsdl [, array options])
+/* {{{ proto object SoapServer::setPersistence ( int mode )
    Sets persistence mode of SoapServer */
 PHP_METHOD(SoapServer, setPersistence)
 {
@@ -1805,8 +1805,8 @@ fail:
 /* }}} */
 
 
-/* {{{ proto SoapServer::fault
-   SoapServer::fault */
+/* {{{ proto SoapServer::fault ( staring code, string string [, string actor [, mixed details [, string name]]] )
+   Issue SoapFault indicating an error */
 PHP_METHOD(SoapServer, fault)
 {
        char *code, *string, *actor=NULL, *name=NULL;
@@ -2781,25 +2781,25 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
          RETURN_NULL();
        }
 
-    if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) {
+       if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) {
                zend_hash_del(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers"));
-    } else if (Z_TYPE_P(headers) == IS_ARRAY || Z_TYPE_P(headers) == IS_OBJECT) {
+       } else if (Z_TYPE_P(headers) == IS_ARRAY) {
                zval *default_headers;
 
                verify_soap_headers_array(Z_ARRVAL_P(headers) TSRMLS_CC);
                if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers"), (void **) &default_headers)==FAILURE) {
                        add_property_zval(this_ptr, "__default_headers", headers);
                }
-    } else if (Z_TYPE_P(headers) == IS_OBJECT &&
-               Z_OBJCE_P(headers) == soap_header_class_entry) {
+       } else if (Z_TYPE_P(headers) == IS_OBJECT &&
+                  Z_OBJCE_P(headers) == soap_header_class_entry) {
                zval *default_headers;
                ALLOC_INIT_ZVAL(default_headers);
                array_init(default_headers);
                add_next_index_zval(default_headers, headers);
                add_property_zval(this_ptr, "__default_headers", default_headers);
-    } else{
-        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid SOAP header");
-    }
+       } else{
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid SOAP header");
+       }
        RETURN_TRUE;
 }
 /* }}} */