summaryrefslogtreecommitdiff
path: root/ext/simplexml
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-09-19 10:38:31 +0000
committerDmitry Stogov <dmitry@php.net>2006-09-19 10:38:31 +0000
commit128548a5c064b8f817c2fc4988b3da383731e65e (patch)
tree9fdd4f8919a19a6582ef03d417dffbbb2ee003d0 /ext/simplexml
parent591477b1435eb7dc6e25fd735de712e264e3d658 (diff)
downloadphp-git-128548a5c064b8f817c2fc4988b3da383731e65e.tar.gz
Disabled autoconversion of hash keys (from string to unicode) for PHP arrays
Diffstat (limited to 'ext/simplexml')
-rw-r--r--ext/simplexml/simplexml.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 9e460da568..85b39a7fbc 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -996,7 +996,16 @@ static HashTable * sxe_properties_get(zval *object TSRMLS_DC)
array_init(zattr);
sxe_properties_add(rv, "@attributes", sizeof("@attributes"), zattr TSRMLS_CC);
}
- add_assoc_zval_ex(zattr, (char*)attr->name, namelen, value);
+ if (UG(unicode)) {
+ UErrorCode status = U_ZERO_ERROR;
+ zstr u_name;
+ int u_name_len;
+ zend_string_to_unicode_ex(UG(utf8_conv), &u_name.u, &u_name_len, (char*)attr->name, namelen, &status);
+ add_u_assoc_zval_ex(zattr, IS_UNICODE, u_name, u_name_len, value);
+ efree(u_name.u);
+ } else {
+ add_assoc_zval_ex(zattr, (char*)attr->name, namelen, value);
+ }
}
attr = attr->next;
}
@@ -1288,14 +1297,17 @@ static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns TSRMLS
prefix_len = strlen(prefix) + 1;
- if (zend_hash_exists(Z_ARRVAL_P(return_value), prefix, prefix_len) == 0) {
+ if (zend_ascii_hash_exists(Z_ARRVAL_P(return_value), prefix, prefix_len) == 0) {
if (UG(unicode)) {
UErrorCode status = U_ZERO_ERROR;
UChar *u_str;
- int u_len;
+ zstr u_prefix;
+ int u_len, u_prefix_len;
int length = strlen((char*)ns->href);
zend_string_to_unicode_ex(UG(utf8_conv), &u_str, &u_len, (char*)ns->href, length, &status);
- add_assoc_unicodel_ex(return_value, prefix, prefix_len, u_str, u_len, 0);
+ zend_string_to_unicode_ex(UG(utf8_conv), &u_prefix.u, &u_prefix_len, prefix, prefix_len, &status);
+ add_u_assoc_unicodel_ex(return_value, IS_UNICODE, u_prefix, u_prefix_len, u_str, u_len, 0);
+ efree(u_prefix.u);
} else {
add_assoc_string_ex(return_value, prefix, prefix_len, (char*)ns->href, 1);
}