dmitry          Mon Dec 18 14:39:23 2006 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/soap/tests/bugs        bug39832.phpt bug39832.wsdl 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/soap   php_encoding.c 
  Log:
  Fixed bug #39832 (SOAP Server: parameter not matching the WSDL specified type 
are set to 0)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.435&r2=1.2027.2.547.2.436&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.435 php-src/NEWS:1.2027.2.547.2.436
--- php-src/NEWS:1.2027.2.547.2.435     Mon Dec 18 11:39:19 2006
+++ php-src/NEWS        Mon Dec 18 14:39:22 2006
@@ -6,6 +6,8 @@
   . cookies
   . canary protection (debug build only)
   . random generation of cookies and canaries
+- Fixed bug #39832 (SOAP Server: parameter not matching the WSDL specified type
+  are set to 0). (Dmitry)
 
 14 Dec 2006, PHP 5.2.1RC1
 - Added a meta tag to phpinfo() output to prevent search engines from indexing 
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.103.2.21.2.16&r2=1.103.2.21.2.17&diff_format=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.103.2.21.2.16 
php-src/ext/soap/php_encoding.c:1.103.2.21.2.17
--- php-src/ext/soap/php_encoding.c:1.103.2.21.2.16     Fri Nov 10 15:05:22 2006
+++ php-src/ext/soap/php_encoding.c     Mon Dec 18 14:39:23 2006
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_encoding.c,v 1.103.2.21.2.16 2006/11/10 15:05:22 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.103.2.21.2.17 2006/12/18 14:39:23 dmitry Exp $ */
 
 #include <time.h>
 
@@ -669,9 +669,15 @@
                if (data->children->type == XML_TEXT_NODE && 
data->children->next == NULL) {
                        whiteSpace_collapse(data->children->content);
                        str = (char*)php_base64_decode(data->children->content, 
strlen((char*)data->children->content), &str_len);
+                       if (!str) {
+                               soap_error0(E_ERROR, "Encoding: Violation of 
encoding rules");
+                       }
                        ZVAL_STRINGL(ret, str, str_len, 0);
                } else if (data->children->type == XML_CDATA_SECTION_NODE && 
data->children->next == NULL) {
                        str = (char*)php_base64_decode(data->children->content, 
strlen((char*)data->children->content), &str_len);
+                       if (!str) {
+                               soap_error0(E_ERROR, "Encoding: Violation of 
encoding rules");
+                       }
                        ZVAL_STRINGL(ret, str, str_len, 0);
                } else {
                        soap_error0(E_ERROR, "Encoding: Violation of encoding 
rules");
@@ -708,6 +714,8 @@
                                str[i] = (c - 'a' + 10) << 4;
                        } else if (c >= 'A' && c <= 'F') {
                                str[i] = (c - 'A' + 10) << 4;
+                       } else {
+                               soap_error0(E_ERROR, "Encoding: Violation of 
encoding rules");
                        }
                        c = data->children->content[j++];
                        if (c >= '0' && c <= '9') {
@@ -716,6 +724,8 @@
                                str[i] |= c - 'a' + 10;
                        } else if (c >= 'A' && c <= 'F') {
                                str[i] |= c - 'A' + 10;
+                       } else {
+                               soap_error0(E_ERROR, "Encoding: Violation of 
encoding rules");
                        }
                }
                str[str_len] = '\0';
@@ -858,8 +868,22 @@
 
        if (data && data->children) {
                if (data->children->type == XML_TEXT_NODE && 
data->children->next == NULL) {
+                       long lval;
+                       double dval;
+
                        whiteSpace_collapse(data->children->content);
-                       ZVAL_DOUBLE(ret, atof((char*)data->children->content));
+                       switch 
(is_numeric_string((char*)data->children->content, 
strlen((char*)data->children->content), &lval, &dval, 0)) {
+                               case IS_LONG:
+                                       Z_TYPE_P(ret) = IS_DOUBLE;
+                                       Z_DVAL_P(ret) = lval;
+                                       break;
+                               case IS_DOUBLE:
+                                       Z_TYPE_P(ret) = IS_DOUBLE;
+                                       Z_DVAL_P(ret) = dval;
+                                       break;
+                               default:
+                                       soap_error0(E_ERROR, "Encoding: 
Violation of encoding rules");
+                       }
                } else {
                        soap_error0(E_ERROR, "Encoding: Violation of encoding 
rules");
                }
@@ -877,14 +901,21 @@
 
        if (data && data->children) {
                if (data->children->type == XML_TEXT_NODE && 
data->children->next == NULL) {
+                       long lval;
+                       double dval;
+
                        whiteSpace_collapse(data->children->content);
                        errno = 0;
-                       ret->value.lval = 
strtol((char*)data->children->content, NULL, 0);
-                       if (errno == ERANGE) { /* overflow */
-                               ret->value.dval = 
zend_strtod((char*)data->children->content, NULL);
-                               ret->type = IS_DOUBLE;
-                       } else {
-                               ret->type = IS_LONG;
+
+                       switch ((Z_TYPE_P(ret) = 
is_numeric_string((char*)data->children->content, 
strlen((char*)data->children->content), &lval, &dval, 0))) {
+                               case IS_LONG:
+                                       Z_LVAL_P(ret) = lval;
+                                       break;
+                               case IS_DOUBLE:
+                                       Z_DVAL_P(ret) = dval;
+                                       break;
+                               default:
+                                       soap_error0(E_ERROR, "Encoding: 
Violation of encoding rules");
                        }
                } else {
                        soap_error0(E_ERROR, "Encoding: Violation of encoding 
rules");

http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug39832.phpt?view=markup&rev=1.1
Index: php-src/ext/soap/tests/bugs/bug39832.phpt
+++ php-src/ext/soap/tests/bugs/bug39832.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug39832.wsdl?view=markup&rev=1.1
Index: php-src/ext/soap/tests/bugs/bug39832.wsdl
+++ php-src/ext/soap/tests/bugs/bug39832.wsdl

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to