dmitry Tue Sep 7 10:34:46 2004 EDT
Modified files:
/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.74&r2=1.75&ty=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.74 php-src/ext/soap/php_encoding.c:1.75
--- php-src/ext/soap/php_encoding.c:1.74 Thu Aug 26 14:40:10 2004
+++ php-src/ext/soap/php_encoding.c Tue Sep 7 10:34:46 2004
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.c,v 1.74 2004/08/26 18:40:10 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.75 2004/09/07 14:34:46 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