summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2005-12-07 16:52:13 +0000
committerDmitry Stogov <dmitry@php.net>2005-12-07 16:52:13 +0000
commit8010c59c88c58040ca566f5aaf1aa20c0d7d7d63 (patch)
treec4ca8574d62280ddc07fb2354c35cebc900b1257 /ext
parentce89a8831efface19279a26ba3cf96c7eff58e92 (diff)
downloadphp-git-8010c59c88c58040ca566f5aaf1aa20c0d7d7d63.tar.gz
Unicode support
Diffstat (limited to 'ext')
-rw-r--r--ext/simplexml/simplexml.c27
-rwxr-xr-xext/simplexml/tests/000.phpt32
-rw-r--r--ext/simplexml/tests/001.phpt4
-rw-r--r--ext/simplexml/tests/002.phpt4
-rwxr-xr-xext/simplexml/tests/003.phpt6
-rwxr-xr-xext/simplexml/tests/004.phpt4
-rwxr-xr-xext/simplexml/tests/007.phpt2
-rw-r--r--ext/simplexml/tests/010.phpt4
-rwxr-xr-xext/simplexml/tests/022.phpt6
-rwxr-xr-xext/simplexml/tests/023.phpt2
-rwxr-xr-xext/simplexml/tests/024.phpt32
-rwxr-xr-xext/spl/tests/sxe_001.phpt4
12 files changed, 63 insertions, 64 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 6d2b2b2efe..f4e97e6016 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -746,16 +746,6 @@ static void sxe_dimension_delete(zval *object, zval *offset TSRMLS_DC)
}
/* }}} */
-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 @@ static void _get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval
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 @@ static HashTable * sxe_properties_get(zval *object TSRMLS_DC)
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 @@ static HashTable * sxe_properties_get(zval *object TSRMLS_DC)
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 @@ static HashTable * sxe_properties_get(zval *object TSRMLS_DC)
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;
}
diff --git a/ext/simplexml/tests/000.phpt b/ext/simplexml/tests/000.phpt
index 4af67010b3..d11c271dac 100755
--- a/ext/simplexml/tests/000.phpt
+++ b/ext/simplexml/tests/000.phpt
@@ -261,20 +261,20 @@ object(SimpleXMLElement)#%d (3) {
[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 @@ object(SimpleXMLElement)#%d (3) {
[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 @@ object(SimpleXMLElement)#%d (3) {
[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 @@ object(SimpleXMLElement)#%d (3) {
[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 @@ object(SimpleXMLElement)#%d (3) {
[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 @@ object(SimpleXMLElement)#%d (2) {
[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 @@ object(SimpleXMLElement)#%d (1) {
[u"@attributes"]=>
array(2) {
[u"attr1"]=>
- string(2) "11"
+ unicode(2) "11"
[u"attr2"]=>
- string(2) "12"
+ unicode(2) "12"
}
}
===sxe->elem1[2]
diff --git a/ext/simplexml/tests/001.phpt b/ext/simplexml/tests/001.phpt
index 5dc9abfd6f..b5c51ff960 100644
--- a/ext/simplexml/tests/001.phpt
+++ b/ext/simplexml/tests/001.phpt
@@ -46,14 +46,14 @@ object(SimpleXMLElement)#%d (2) {
[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) {
diff --git a/ext/simplexml/tests/002.phpt b/ext/simplexml/tests/002.phpt
index 8632207d24..6d1679faa4 100644
--- a/ext/simplexml/tests/002.phpt
+++ b/ext/simplexml/tests/002.phpt
@@ -67,14 +67,14 @@ object(SimpleXMLElement)#%d (2) {
[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) {
diff --git a/ext/simplexml/tests/003.phpt b/ext/simplexml/tests/003.phpt
index 978768a366..9cb5c0e5dc 100755
--- a/ext/simplexml/tests/003.phpt
+++ b/ext/simplexml/tests/003.phpt
@@ -72,14 +72,14 @@ object(SimpleXMLElement)#%d (2) {
[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 @@ object(SimpleXMLElement)#%d (2) {
[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) {
diff --git a/ext/simplexml/tests/004.phpt b/ext/simplexml/tests/004.phpt
index c2f462be6b..bb5916440b 100755
--- a/ext/simplexml/tests/004.phpt
+++ b/ext/simplexml/tests/004.phpt
@@ -71,14 +71,14 @@ object(SimpleXMLElement)#%d (2) {
[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) {
diff --git a/ext/simplexml/tests/007.phpt b/ext/simplexml/tests/007.phpt
index 5a7ba29deb..5a2cf6f9c0 100755
--- a/ext/simplexml/tests/007.phpt
+++ b/ext/simplexml/tests/007.phpt
@@ -101,7 +101,7 @@ object(SimpleXMLElement)#%d (3) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(5) "first"
+ unicode(5) "first"
}
[u"comment"]=>
object(SimpleXMLElement)#%d (0) {
diff --git a/ext/simplexml/tests/010.phpt b/ext/simplexml/tests/010.phpt
index a71618ba01..5318a525a3 100644
--- a/ext/simplexml/tests/010.phpt
+++ b/ext/simplexml/tests/010.phpt
@@ -67,14 +67,14 @@ object(simplexml_inherited)#%d (2) {
[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) {
diff --git a/ext/simplexml/tests/022.phpt b/ext/simplexml/tests/022.phpt
index 36cc0145b3..5374bbaa2d 100755
--- a/ext/simplexml/tests/022.phpt
+++ b/ext/simplexml/tests/022.phpt
@@ -68,7 +68,7 @@ object(SimpleXMLElement)#%d (1) {
[u"@attributes"]=>
array(1) {
[u"glob"]=>
- string(11) "slide_*.xml"
+ unicode(11) "slide_*.xml"
}
}
}
@@ -77,7 +77,7 @@ object(SimpleXMLElement)#%d (1) {
[u"@attributes"]=>
array(1) {
[u"glob"]=>
- string(11) "slide_*.xml"
+ unicode(11) "slide_*.xml"
}
}
===FOREACH===
@@ -85,7 +85,7 @@ object(SimpleXMLElement)#%d (1) {
[u"@attributes"]=>
array(1) {
[u"glob"]=>
- string(11) "slide_*.xml"
+ unicode(11) "slide_*.xml"
}
}
object(SimpleXMLElement)#%d (1) {
diff --git a/ext/simplexml/tests/023.phpt b/ext/simplexml/tests/023.phpt
index 449daf47b7..be82b78f38 100755
--- a/ext/simplexml/tests/023.phpt
+++ b/ext/simplexml/tests/023.phpt
@@ -39,7 +39,7 @@ object(SimpleXMLElement)#%d (1) {
[u"@attributes"]=>
array(1) {
[u"attr"]=>
- string(%d) "foo%sbar%sbaz"
+ unicode(%d) "foo%sbar%sbaz"
}
}
object(SimpleXMLElement)#%d (1) {
diff --git a/ext/simplexml/tests/024.phpt b/ext/simplexml/tests/024.phpt
index a136cfb9cc..018d7e50b6 100755
--- a/ext/simplexml/tests/024.phpt
+++ b/ext/simplexml/tests/024.phpt
@@ -181,7 +181,7 @@ array(3) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "12"
+ unicode(2) "12"
}
}
[1]=>
@@ -189,7 +189,7 @@ array(3) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "22"
+ unicode(2) "22"
}
}
[2]=>
@@ -197,7 +197,7 @@ array(3) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "32"
+ unicode(2) "32"
}
}
}
@@ -208,7 +208,7 @@ array(3) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "12"
+ unicode(2) "12"
}
}
[1]=>
@@ -216,7 +216,7 @@ array(3) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "22"
+ unicode(2) "22"
}
}
[2]=>
@@ -224,7 +224,7 @@ array(3) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "32"
+ unicode(2) "32"
}
}
}
@@ -235,7 +235,7 @@ array(9) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(2) "11"
+ unicode(2) "11"
}
}
[1]=>
@@ -243,7 +243,7 @@ array(9) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "12"
+ unicode(2) "12"
}
}
[2]=>
@@ -251,7 +251,7 @@ array(9) {
[u"@attributes"]=>
array(1) {
[u"attr3"]=>
- string(2) "13"
+ unicode(2) "13"
}
}
[3]=>
@@ -259,7 +259,7 @@ array(9) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(2) "21"
+ unicode(2) "21"
}
}
[4]=>
@@ -267,7 +267,7 @@ array(9) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "22"
+ unicode(2) "22"
}
}
[5]=>
@@ -275,7 +275,7 @@ array(9) {
[u"@attributes"]=>
array(1) {
[u"attr3"]=>
- string(2) "23"
+ unicode(2) "23"
}
}
[6]=>
@@ -283,7 +283,7 @@ array(9) {
[u"@attributes"]=>
array(1) {
[u"attr1"]=>
- string(2) "31"
+ unicode(2) "31"
}
}
[7]=>
@@ -291,7 +291,7 @@ array(9) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "32"
+ unicode(2) "32"
}
}
[8]=>
@@ -299,7 +299,7 @@ array(9) {
[u"@attributes"]=>
array(1) {
[u"attr3"]=>
- string(2) "33"
+ unicode(2) "33"
}
}
}
@@ -310,7 +310,7 @@ array(1) {
[u"@attributes"]=>
array(1) {
[u"attr2"]=>
- string(2) "22"
+ unicode(2) "22"
}
}
}
diff --git a/ext/spl/tests/sxe_001.phpt b/ext/spl/tests/sxe_001.phpt
index 11d8eeee23..0f5530249e 100755
--- a/ext/spl/tests/sxe_001.phpt
+++ b/ext/spl/tests/sxe_001.phpt
@@ -67,14 +67,14 @@ object(SimpleXMLIterator)#%d (2) {
[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) {