dmitry Wed Dec 7 11:52:13 2005 EDT
Modified files:
/php-src/ext/simplexml simplexml.c
/php-src/ext/simplexml/tests 000.phpt 001.phpt 002.phpt 003.phpt
004.phpt 007.phpt 010.phpt 022.phpt
023.phpt 024.phpt
/php-src/ext/spl/tests sxe_001.phpt
Log:
Unicode support
http://cvs.php.net/diff.php/php-src/ext/simplexml/simplexml.c?r1=1.180&r2=1.181&ty=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.180
php-src/ext/simplexml/simplexml.c:1.181
--- php-src/ext/simplexml/simplexml.c:1.180 Mon Dec 5 21:24:46 2005
+++ php-src/ext/simplexml/simplexml.c Wed Dec 7 11:52:12 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c,v 1.180 2005/12/06 02:24:46 sniper Exp $ */
+/* $Id: simplexml.c,v 1.181 2005/12/07 16:52:12 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -746,16 +746,6 @@
}
/* }}} */
-static inline char * sxe_xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list,
int inLine)
-{
- xmlChar *tmp = xmlNodeListGetString(doc, list, inLine);
- char *res = estrdup((char*)tmp);
-
- xmlFree(tmp);
-
- return res;
-}
-
/* {{{ _get_base_node_value()
*/
static void _get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node,
zval **value, char *prefix TSRMLS_DC)
@@ -768,7 +758,7 @@
if (node->children && node->children->type == XML_TEXT_NODE &&
!xmlIsBlankNode(node->children)) {
contents = xmlNodeListGetString(node->doc, node->children, 1);
if (contents) {
- ZVAL_STRING(*value, contents, 1);
+
ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), *value, contents, 1);
xmlFree(contents);
}
} else {
@@ -846,8 +836,11 @@
test = sxe->iter.name && sxe->iter.type == SXE_ITER_ATTRLIST;
while (attr) {
if ((!test || !xmlStrcmp(attr->name, sxe->iter.name))
&& match_ns(sxe, (xmlNodePtr)attr, sxe->iter.nsprefix)) {
+ xmlChar *tmp;
+
MAKE_STD_ZVAL(value);
- ZVAL_STRING(value,
sxe_xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1), 0);
+
ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), value, tmp =
xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1), 1);
+ xmlFree(tmp);
namelen = xmlStrlen(attr->name) + 1;
if (!zattr) {
MAKE_STD_ZVAL(zattr);
@@ -864,8 +857,11 @@
node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
if (node && sxe->iter.type != SXE_ITER_ATTRLIST) {
if (node->type == XML_ATTRIBUTE_NODE) {
+ xmlChar *tmp;
+
MAKE_STD_ZVAL(value);
-
ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), value,
sxe_xmlNodeListGetString(node->doc, node->children, 1), 0);
+
ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), value, tmp =
xmlNodeListGetString(node->doc, node->children, 1), 1);
+ xmlFree(tmp);
zend_hash_next_index_insert(rv, &value, sizeof(zval *),
NULL);
node = NULL;
} else {
@@ -877,8 +873,11 @@
SKIP_TEXT(node);
} else {
if (node->type == XML_TEXT_NODE) {
+ xmlChar *tmp;
+
MAKE_STD_ZVAL(value);
-
ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), value,
sxe_xmlNodeListGetString(node->doc, node, 1), 0);
+
ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), value, tmp =
xmlNodeListGetString(node->doc, node, 1), 1);
+ xmlFree(tmp);
zend_hash_next_index_insert(rv, &value,
sizeof(zval *), NULL);
goto next_iter;
}
@@ -2029,7 +2028,7 @@
{
php_info_print_table_start();
php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.180 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.181 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/000.phpt?r1=1.4&r2=1.5&ty=u
Index: php-src/ext/simplexml/tests/000.phpt
diff -u php-src/ext/simplexml/tests/000.phpt:1.4
php-src/ext/simplexml/tests/000.phpt:1.5
--- php-src/ext/simplexml/tests/000.phpt:1.4 Mon Oct 31 15:06:28 2005
+++ php-src/ext/simplexml/tests/000.phpt Wed Dec 7 11:52:13 2005
@@ -261,20 +261,20 @@
[u"@attributes"]=>
array(1) {
[u"id"]=>
- string(3) "123"
+ unicode(3) "123"
}
[u"elem1"]=>
array(2) {
[0]=>
- string(36) "There is some text.Here is some more"
+ unicode(36) "There is some text.Here is some more"
[1]=>
object(SimpleXMLElement)#%d (1) {
[u"@attributes"]=>
array(2) {
[u"attr1"]=>
- string(2) "11"
+ unicode(2) "11"
[u"attr2"]=>
- string(2) "12"
+ unicode(2) "12"
}
}
}
@@ -296,9 +296,9 @@
[u"@attributes"]=>
array(2) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
[u"attr2"]=>
- string(6) "second"
+ unicode(6) "second"
}
[u"comment"]=>
object(SimpleXMLElement)#%d (0) {
@@ -308,9 +308,9 @@
[u"@attributes"]=>
array(2) {
[u"att25"]=>
- string(2) "25"
+ unicode(2) "25"
[u"att42"]=>
- string(2) "42"
+ unicode(2) "42"
}
[u"elem3"]=>
object(SimpleXMLElement)#%d (1) {
@@ -331,9 +331,9 @@
[u"@attributes"]=>
array(2) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
[u"attr2"]=>
- string(6) "second"
+ unicode(6) "second"
}
[u"comment"]=>
object(SimpleXMLElement)#%d (0) {
@@ -343,9 +343,9 @@
[u"@attributes"]=>
array(2) {
[u"att25"]=>
- string(2) "25"
+ unicode(2) "25"
[u"att42"]=>
- string(2) "42"
+ unicode(2) "42"
}
[u"elem3"]=>
object(SimpleXMLElement)#%d (1) {
@@ -366,9 +366,9 @@
[u"@attributes"]=>
array(2) {
[u"att25"]=>
- string(2) "25"
+ unicode(2) "25"
[u"att42"]=>
- string(2) "42"
+ unicode(2) "42"
}
[u"elem3"]=>
object(SimpleXMLElement)#%d (1) {
@@ -400,9 +400,9 @@
[u"@attributes"]=>
array(2) {
[u"attr1"]=>
- string(2) "11"
+ unicode(2) "11"
[u"attr2"]=>
- string(2) "12"
+ unicode(2) "12"
}
}
===sxe->elem1[2]
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/001.phpt?r1=1.6&r2=1.7&ty=u
Index: php-src/ext/simplexml/tests/001.phpt
diff -u php-src/ext/simplexml/tests/001.phpt:1.6
php-src/ext/simplexml/tests/001.phpt:1.7
--- php-src/ext/simplexml/tests/001.phpt:1.6 Sun Oct 30 09:00:45 2005
+++ php-src/ext/simplexml/tests/001.phpt Wed Dec 7 11:52:13 2005
@@ -46,14 +46,14 @@
[u"@attributes"]=>
array(1) {
[u"id"]=>
- string(5) "elem1"
+ unicode(5) "elem1"
}
[u"elem1"]=>
object(SimpleXMLElement)#%d (3) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
}
[u"comment"]=>
object(SimpleXMLElement)#%d (0) {
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/002.phpt?r1=1.10&r2=1.11&ty=u
Index: php-src/ext/simplexml/tests/002.phpt
diff -u php-src/ext/simplexml/tests/002.phpt:1.10
php-src/ext/simplexml/tests/002.phpt:1.11
--- php-src/ext/simplexml/tests/002.phpt:1.10 Sun Oct 30 09:00:45 2005
+++ php-src/ext/simplexml/tests/002.phpt Wed Dec 7 11:52:13 2005
@@ -67,14 +67,14 @@
[u"@attributes"]=>
array(1) {
[u"id"]=>
- string(5) "elem1"
+ unicode(5) "elem1"
}
[u"elem1"]=>
object(SimpleXMLElement)#%d (3) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
}
[u"comment"]=>
object(SimpleXMLElement)#%d (0) {
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/003.phpt?r1=1.5&r2=1.6&ty=u
Index: php-src/ext/simplexml/tests/003.phpt
diff -u php-src/ext/simplexml/tests/003.phpt:1.5
php-src/ext/simplexml/tests/003.phpt:1.6
--- php-src/ext/simplexml/tests/003.phpt:1.5 Sun Oct 30 09:00:45 2005
+++ php-src/ext/simplexml/tests/003.phpt Wed Dec 7 11:52:13 2005
@@ -72,14 +72,14 @@
[u"@attributes"]=>
array(1) {
[u"id"]=>
- string(5) "elem1"
+ unicode(5) "elem1"
}
[u"elem1"]=>
object(SimpleXMLElement)#%d (3) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
}
[u"comment"]=>
object(SimpleXMLElement)#%d (0) {
@@ -91,7 +91,7 @@
[u"included-entity"]=>
object(SimpleXMLElement)#%d (1) {
[u"included-entity"]=>
- string(36) "This is text included from an entity"
+ unicode(36) "This is text included from an entity"
}
[u"elem4"]=>
object(SimpleXMLElement)#%d (1) {
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/004.phpt?r1=1.9&r2=1.10&ty=u
Index: php-src/ext/simplexml/tests/004.phpt
diff -u php-src/ext/simplexml/tests/004.phpt:1.9
php-src/ext/simplexml/tests/004.phpt:1.10
--- php-src/ext/simplexml/tests/004.phpt:1.9 Sun Oct 30 09:00:45 2005
+++ php-src/ext/simplexml/tests/004.phpt Wed Dec 7 11:52:13 2005
@@ -71,14 +71,14 @@
[u"@attributes"]=>
array(1) {
[u"id"]=>
- string(5) "elem1"
+ unicode(5) "elem1"
}
[u"elem1"]=>
object(SimpleXMLElement)#%d (3) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
}
[u"comment"]=>
object(SimpleXMLElement)#%d (0) {
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/007.phpt?r1=1.11&r2=1.12&ty=u
Index: php-src/ext/simplexml/tests/007.phpt
diff -u php-src/ext/simplexml/tests/007.phpt:1.11
php-src/ext/simplexml/tests/007.phpt:1.12
--- php-src/ext/simplexml/tests/007.phpt:1.11 Sun Oct 30 09:00:45 2005
+++ php-src/ext/simplexml/tests/007.phpt Wed Dec 7 11:52:13 2005
@@ -101,7 +101,7 @@
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
}
[u"comment"]=>
object(SimpleXMLElement)#%d (0) {
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/010.phpt?r1=1.7&r2=1.8&ty=u
Index: php-src/ext/simplexml/tests/010.phpt
diff -u php-src/ext/simplexml/tests/010.phpt:1.7
php-src/ext/simplexml/tests/010.phpt:1.8
--- php-src/ext/simplexml/tests/010.phpt:1.7 Sun Oct 30 09:00:45 2005
+++ php-src/ext/simplexml/tests/010.phpt Wed Dec 7 11:52:13 2005
@@ -67,14 +67,14 @@
[u"@attributes"]=>
array(1) {
[u"id"]=>
- string(5) "elem1"
+ unicode(5) "elem1"
}
[u"elem1"]=>
object(simplexml_inherited)#%d (3) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
}
[u"comment"]=>
object(simplexml_inherited)#%d (0) {
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/022.phpt?r1=1.4&r2=1.5&ty=u
Index: php-src/ext/simplexml/tests/022.phpt
diff -u php-src/ext/simplexml/tests/022.phpt:1.4
php-src/ext/simplexml/tests/022.phpt:1.5
--- php-src/ext/simplexml/tests/022.phpt:1.4 Sun Oct 30 09:00:45 2005
+++ php-src/ext/simplexml/tests/022.phpt Wed Dec 7 11:52:13 2005
@@ -68,7 +68,7 @@
[u"@attributes"]=>
array(1) {
[u"glob"]=>
- string(11) "slide_*.xml"
+ unicode(11) "slide_*.xml"
}
}
}
@@ -77,7 +77,7 @@
[u"@attributes"]=>
array(1) {
[u"glob"]=>
- string(11) "slide_*.xml"
+ unicode(11) "slide_*.xml"
}
}
===FOREACH===
@@ -85,7 +85,7 @@
[u"@attributes"]=>
array(1) {
[u"glob"]=>
- string(11) "slide_*.xml"
+ unicode(11) "slide_*.xml"
}
}
object(SimpleXMLElement)#%d (1) {
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/023.phpt?r1=1.5&r2=1.6&ty=u
Index: php-src/ext/simplexml/tests/023.phpt
diff -u php-src/ext/simplexml/tests/023.phpt:1.5
php-src/ext/simplexml/tests/023.phpt:1.6
--- php-src/ext/simplexml/tests/023.phpt:1.5 Wed Nov 30 03:14:49 2005
+++ php-src/ext/simplexml/tests/023.phpt Wed Dec 7 11:52:13 2005
@@ -39,7 +39,7 @@
[u"@attributes"]=>
array(1) {
[u"attr"]=>
- string(%d) "foo%sbar%sbaz"
+ unicode(%d) "foo%sbar%sbaz"
}
}
object(SimpleXMLElement)#%d (1) {
http://cvs.php.net/diff.php/php-src/ext/simplexml/tests/024.phpt?r1=1.2&r2=1.3&ty=u
Index: php-src/ext/simplexml/tests/024.phpt
diff -u php-src/ext/simplexml/tests/024.phpt:1.2
php-src/ext/simplexml/tests/024.phpt:1.3
--- php-src/ext/simplexml/tests/024.phpt:1.2 Sun Oct 30 09:00:45 2005
+++ php-src/ext/simplexml/tests/024.phpt Wed Dec 7 11:52:13 2005
@@ -181,7 +181,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "12"
+ unicode(2) "12"
}
}
[1]=>
@@ -189,7 +189,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "22"
+ unicode(2) "22"
}
}
[2]=>
@@ -197,7 +197,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "32"
+ unicode(2) "32"
}
}
}
@@ -208,7 +208,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "12"
+ unicode(2) "12"
}
}
[1]=>
@@ -216,7 +216,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "22"
+ unicode(2) "22"
}
}
[2]=>
@@ -224,7 +224,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "32"
+ unicode(2) "32"
}
}
}
@@ -235,7 +235,7 @@
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(2) "11"
+ unicode(2) "11"
}
}
[1]=>
@@ -243,7 +243,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "12"
+ unicode(2) "12"
}
}
[2]=>
@@ -251,7 +251,7 @@
[u"@attributes"]=>
array(1) {
[u"attr3"]=>
- string(2) "13"
+ unicode(2) "13"
}
}
[3]=>
@@ -259,7 +259,7 @@
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(2) "21"
+ unicode(2) "21"
}
}
[4]=>
@@ -267,7 +267,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "22"
+ unicode(2) "22"
}
}
[5]=>
@@ -275,7 +275,7 @@
[u"@attributes"]=>
array(1) {
[u"attr3"]=>
- string(2) "23"
+ unicode(2) "23"
}
}
[6]=>
@@ -283,7 +283,7 @@
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(2) "31"
+ unicode(2) "31"
}
}
[7]=>
@@ -291,7 +291,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "32"
+ unicode(2) "32"
}
}
[8]=>
@@ -299,7 +299,7 @@
[u"@attributes"]=>
array(1) {
[u"attr3"]=>
- string(2) "33"
+ unicode(2) "33"
}
}
}
@@ -310,7 +310,7 @@
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "22"
+ unicode(2) "22"
}
}
}
http://cvs.php.net/diff.php/php-src/ext/spl/tests/sxe_001.phpt?r1=1.4&r2=1.5&ty=u
Index: php-src/ext/spl/tests/sxe_001.phpt
diff -u php-src/ext/spl/tests/sxe_001.phpt:1.4
php-src/ext/spl/tests/sxe_001.phpt:1.5
--- php-src/ext/spl/tests/sxe_001.phpt:1.4 Sun Oct 30 09:00:23 2005
+++ php-src/ext/spl/tests/sxe_001.phpt Wed Dec 7 11:52:13 2005
@@ -67,14 +67,14 @@
[u"@attributes"]=>
array(1) {
[u"id"]=>
- string(5) "elem1"
+ unicode(5) "elem1"
}
[u"elem1"]=>
object(SimpleXMLIterator)#%d (3) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
}
[u"comment"]=>
object(SimpleXMLIterator)#%d (0) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php