Re: cvs: php-src(PHP_5_0) /ext/soap php_encoding.c

From: Date: Tue, 07 Sep 2004 18:50:31 +0000
Subject: Re: cvs: php-src(PHP_5_0) /ext/soap php_encoding.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-28583@lists.php.net to get a copy of this message
Is this fixed in libxml2? If so, maybe you should put a version check around these functions so that it's clear why this code exists (and so that we can nuke it in future?) Andi At 02:41 PM 9/7/2004 +0000, Dmitry Stogov wrote:
dmitry          Tue Sep  7 10:41:29 2004 EDT
  Modified files:              (Branch: PHP_5_0)
    /php-src/ext/soap   php_encoding.c
Log: Make ext/soap work around libxml2 bug in xmlCheckUTF8 (2.6.7-2.6.13) http://cvs.php.net/diff.php/php-src/ext/soap/php_encoding.c?r1=1.71.2.3&r2=1.71.2.4&ty=u Index: php-src/ext/soap/php_encoding.c diff -u php-src/ext/soap/php_encoding.c:1.71.2.3 php-src/ext/soap/php_encoding.c:1.71.2.4
--- php-src/ext/soap/php_encoding.c:1.71.2.3    Thu Aug 26 14:36:46 2004
+++ php-src/ext/soap/php_encoding.c     Tue Sep  7 10:41:29 2004
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <dmitry@zend.com>                             |
+----------------------------------------------------------------------+ */ -/* $Id: php_encoding.c,v 1.71.2.3 2004/08/26 18:36:46 dmitry Exp $ */ +/* $Id: php_encoding.c,v 1.71.2.4 2004/09/07 14:41:29 dmitry Exp $ */ #include <time.h> @@ -581,6 +581,32 @@
        return ret;
} +static int php_soap_xmlCheckUTF8(const unsigned char *s) +{
+       int i;
+       unsigned char c;
+
+       for (i = 0; (c = s[i++]);) {
+               if ((c & 0x80) == 0) {
+               } else if ((c & 0xe0) == 0xc0) {
+                       if ((s[i++] & 0xc0) != 0x80) {
+                               return 0;
+                       }
+               } else if ((c & 0xf0) == 0xe0) {
+                       if ((s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80) {
+                               return 0;
+                       }
+               } else if ((c & 0xf8) == 0xf0) {
+                       if ((s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80) {
+                               return 0;
+                       }
+               } else {
+                       return 0;
+               }
+       }
+       return 1;
+} + static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNodePtr parent) {
        xmlNodePtr ret;
@@ -612,12 +638,12 @@
                        efree(str);
                        str = estrdup(xmlBufferContent(out));
                        new_len = n;
-               } else if (!xmlCheckUTF8(str)) {
+               } else if (!php_soap_xmlCheckUTF8(str)) {
                        soap_error1(E_ERROR,  "Encoding: string '%s' is not a valid utf-8 string", str);
                }
                xmlBufferFree(out);
                xmlBufferFree(in);
-       } else if (!xmlCheckUTF8(str)) {
+       } else if (!php_soap_xmlCheckUTF8(str)) {
                soap_error1(E_ERROR,  "Encoding: string '%s' is not a valid utf-8 string", str);
        }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.cvs (#28583) next »