]> granicus.if.org Git - php/commitdiff
add unicode support
authorRob Richards <rrichards@php.net>
Tue, 8 Aug 2006 20:52:45 +0000 (20:52 +0000)
committerRob Richards <rrichards@php.net>
Tue, 8 Aug 2006 20:52:45 +0000 (20:52 +0000)
update tests (binary string must be passed to simplexml_load_string)

57 files changed:
ext/simplexml/simplexml.c
ext/simplexml/tests/002.phpt
ext/simplexml/tests/003.phpt
ext/simplexml/tests/004.phpt
ext/simplexml/tests/005.phpt
ext/simplexml/tests/006.phpt
ext/simplexml/tests/007.phpt
ext/simplexml/tests/008.phpt
ext/simplexml/tests/009.phpt
ext/simplexml/tests/009b.phpt
ext/simplexml/tests/010.phpt
ext/simplexml/tests/011.phpt
ext/simplexml/tests/012.phpt
ext/simplexml/tests/013.phpt
ext/simplexml/tests/014.phpt
ext/simplexml/tests/014a.phpt
ext/simplexml/tests/014b.phpt
ext/simplexml/tests/015.phpt
ext/simplexml/tests/016.phpt
ext/simplexml/tests/016a.phpt
ext/simplexml/tests/017.phpt
ext/simplexml/tests/018.phpt
ext/simplexml/tests/019.phpt
ext/simplexml/tests/020.phpt
ext/simplexml/tests/021.phpt
ext/simplexml/tests/022.phpt
ext/simplexml/tests/023.phpt
ext/simplexml/tests/024.phpt
ext/simplexml/tests/025.phpt
ext/simplexml/tests/026.phpt
ext/simplexml/tests/027.phpt
ext/simplexml/tests/028.phpt
ext/simplexml/tests/029.phpt
ext/simplexml/tests/030.phpt
ext/simplexml/tests/031.phpt
ext/simplexml/tests/032.phpt
ext/simplexml/tests/033.phpt
ext/simplexml/tests/bug26976.phpt
ext/simplexml/tests/bug27010.phpt
ext/simplexml/tests/bug35785.phpt
ext/simplexml/tests/bug36611.phpt
ext/simplexml/tests/bug37565.phpt
ext/simplexml/tests/bug38347.phpt
ext/simplexml/tests/bug38354.phpt
ext/simplexml/tests/profile01.phpt
ext/simplexml/tests/profile02.phpt
ext/simplexml/tests/profile03.phpt
ext/simplexml/tests/profile04.phpt
ext/simplexml/tests/profile05.phpt
ext/simplexml/tests/profile06.phpt
ext/simplexml/tests/profile07.phpt
ext/simplexml/tests/profile08.phpt
ext/simplexml/tests/profile09.phpt
ext/simplexml/tests/profile10.phpt
ext/simplexml/tests/profile11.phpt
ext/simplexml/tests/profile12.phpt
ext/simplexml/tests/profile13.phpt

index 680c066442a11ee276ad1888e124637019119c26..44bb3c520541442f4b5735911db7035490d53d15 100644 (file)
@@ -254,7 +254,7 @@ static zval * sxe_prop_dim_read(zval *object, zval *member, zend_bool elements,
                        tmp_zv = *member;
                        zval_copy_ctor(&tmp_zv);
                        member = &tmp_zv;
-                       convert_to_string(member);
+                       convert_to_string_with_converter(member, UG(utf8_conv));
                }
                name = Z_STRVAL_P(member);
        }
@@ -383,7 +383,7 @@ static void change_node_zval(xmlNodePtr node, zval *value TSRMLS_DC)
                                zval_copy_ctor(&value_copy);
                                value = &value_copy;
                        }
-                       convert_to_string(value);
+                       convert_to_string_with_converter(value, UG(utf8_conv));
                        /* break missing intentionally */
                case IS_STRING:
                        xmlNodeSetContentLen(node, (xmlChar *)Z_STRVAL_P(value), Z_STRLEN_P(value));
@@ -437,7 +437,7 @@ static void sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_boo
                if (Z_TYPE_P(member) != IS_STRING) {
                        trim_zv = *member;
                        zval_copy_ctor(&trim_zv);
-                       convert_to_string(&trim_zv);
+                       convert_to_string_with_converter(&trim_zv, UG(utf8_conv));
                        php_trim(Z_STRVAL(trim_zv), Z_STRLEN(trim_zv), NULL, 0, IS_STRING, &tmp_zv, 3 TSRMLS_CC);
                        zval_dtor(&trim_zv);
                        member = &tmp_zv;
@@ -487,7 +487,7 @@ static void sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_boo
                                        zval_copy_ctor(&value_copy);
                                        value = &value_copy;
                                }
-                               convert_to_string(value);
+                               convert_to_string_with_converter(value, UG(utf8_conv));
                                break;
                        case IS_STRING:
                                break;
@@ -611,7 +611,8 @@ static zval** sxe_property_get_adr(zval *object, zval *member TSRMLS_DC) /* {{{
        sxe = php_sxe_fetch_object(object TSRMLS_CC);
 
        GET_NODE(sxe, node);
-       convert_to_string(member);
+       convert_to_string_with_converter(member, UG(utf8_conv));
+
        name = Z_STRVAL_P(member);
        node = sxe_get_element_by_name(sxe, node, &name, &type TSRMLS_CC);
        if (!node) {
@@ -645,7 +646,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
                tmp_zv = *member;
                zval_copy_ctor(&tmp_zv);
                member = &tmp_zv;
-               convert_to_string(member);
+               convert_to_string_with_converter(member, UG(utf8_conv));
        }
 
        sxe = php_sxe_fetch_object(object TSRMLS_CC);
@@ -765,7 +766,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements,
                tmp_zv = *member;
                zval_copy_ctor(&tmp_zv);
                member = &tmp_zv;
-               convert_to_string(member);
+               convert_to_string_with_converter(member, UG(utf8_conv));
        }
 
        sxe = php_sxe_fetch_object(object TSRMLS_CC);
@@ -886,7 +887,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_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), *value, (char *)contents, 1);
+                       ZVAL_XML_STRING(*value, (char *)contents, ZSTR_DUPLICATE);
                        xmlFree(contents);
                }
        } else {
@@ -971,7 +972,8 @@ static HashTable * sxe_properties_get(zval *object TSRMLS_DC)
                                xmlChar *tmp;
 
                                MAKE_STD_ZVAL(value);
-                               ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), value, tmp = xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1), 1);
+                               tmp = xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, attr->children, 1);
+                               ZVAL_XML_STRING(value, (char *)tmp, ZSTR_DUPLICATE);
                                xmlFree(tmp);
                                namelen = xmlStrlen(attr->name) + 1;
                                if (!zattr) {
@@ -992,7 +994,8 @@ static HashTable * sxe_properties_get(zval *object TSRMLS_DC)
                        xmlChar *tmp;
 
                        MAKE_STD_ZVAL(value);
-                       ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), value, tmp = xmlNodeListGetString(node->doc, node->children, 1), 1);
+                       tmp = xmlNodeListGetString(node->doc, node->children, 1);
+                       ZVAL_XML_STRING(value, (char *)tmp, ZSTR_DUPLICATE);
                        xmlFree(tmp);
                        zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL);
                        node = NULL;
@@ -1008,7 +1011,8 @@ static HashTable * sxe_properties_get(zval *object TSRMLS_DC)
                                        xmlChar *tmp;
 
                                        MAKE_STD_ZVAL(value);
-                                       ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), value, tmp = xmlNodeListGetString(node->doc, node, 1), 1);
+                                       tmp = xmlNodeListGetString(node->doc, node, 1);
+                                       ZVAL_XML_STRING(value, (char *)tmp, ZSTR_DUPLICATE);
                                        xmlFree(tmp);
                                        zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL);
                                        goto next_iter;
@@ -1059,7 +1063,7 @@ static int sxe_objects_compare(zval *object1, zval *object2 TSRMLS_DC) /* {{{ */
 }
 /* }}} */
 
-/* {{{ proto array SimpleXMLElement::xpath(string path)
+/* {{{ proto array SimpleXMLElement::xpath(string path) U
    Runs XPath query on the XML data */
 SXE_METHOD(xpath)
 {
@@ -1074,7 +1078,7 @@ SXE_METHOD(xpath)
        xmlNodeSetPtr      result;
        xmlNodePtr                 nodeptr;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &query, &query_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &query, &query_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -1134,7 +1138,7 @@ SXE_METHOD(xpath)
                        if (nodeptr->type == XML_TEXT_NODE) {
                                _node_as_zval(sxe, nodeptr->parent, value, SXE_ITER_NONE, NULL, NULL, 0 TSRMLS_CC);
                        } else if (nodeptr->type == XML_ATTRIBUTE_NODE) {
-                               _node_as_zval(sxe, nodeptr->parent, value, SXE_ITER_ATTRLIST, (char*)nodeptr->name, NULL, 0 TSRMLS_CC);
+                               _node_as_zval(sxe, nodeptr->parent, value, SXE_ITER_ATTRLIST, (char *)nodeptr->name, NULL, 0 TSRMLS_CC);
                        } else {
                                _node_as_zval(sxe, nodeptr, value, SXE_ITER_NONE, NULL, NULL, 0 TSRMLS_CC);
                        }
@@ -1146,7 +1150,7 @@ SXE_METHOD(xpath)
        xmlXPathFreeObject(retval);
 }
 
-/* {{{ proto bool SimpleXMLElement::registerXPathNamespace(string prefix, string ns)
+/* {{{ proto bool SimpleXMLElement::registerXPathNamespace(string prefix, string ns) U
    Creates a prefix/ns context for the next XPath query */
 SXE_METHOD(registerXPathNamespace)
 {
@@ -1154,7 +1158,7 @@ SXE_METHOD(registerXPathNamespace)
        int prefix_len, ns_uri_len;
        char *prefix, *ns_uri;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&", &prefix, &prefix_len, UG(utf8_conv), &ns_uri, &ns_uri_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -1171,7 +1175,7 @@ SXE_METHOD(registerXPathNamespace)
 
 /* }}} */
 
-/* {{{ proto string SimpleXMLElement::asXML([string filename])
+/* {{{ proto string SimpleXMLElement::asXML([string filename]) U
    Return a well-formed XML string based on SimpleXML element */
 SXE_METHOD(asXML)
 {
@@ -1182,13 +1186,14 @@ SXE_METHOD(asXML)
        int                 strval_len;
        char               *filename;
        int                 filename_len;
+       zend_uchar          filename_type;
 
        if (ZEND_NUM_ARGS() > 1) {
                RETURN_FALSE;
        }
 
        if (ZEND_NUM_ARGS() == 1) {
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &filename, &filename_len, &filename_type) == FAILURE) {
                        RETURN_FALSE;
                }
 
@@ -1197,25 +1202,35 @@ SXE_METHOD(asXML)
                node = php_sxe_get_first_node(sxe, node TSRMLS_CC);
 
                if (node) {
+                       if (filename_type == IS_UNICODE) {
+                               if (php_stream_path_encode(NULL, &filename, &filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) {
+                                       RETURN_FALSE;
+                               }
+                       }
+
                        if (XML_DOCUMENT_NODE == node->parent->type) {
                                int bytes;
                                bytes = xmlSaveFile(filename, (xmlDocPtr) sxe->document->ptr);
                                if (bytes == -1) {
-                                       RETURN_FALSE;
+                                       RETVAL_FALSE;
                                } else {
-                                       RETURN_TRUE;
+                                       RETVAL_TRUE;
                                }
                        } else {
                                outbuf = xmlOutputBufferCreateFilename(filename, NULL, 0);
 
                                if (outbuf == NULL) {
-                                       RETURN_FALSE;
+                                       RETVAL_FALSE;
+                               } else {
+                                       xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, NULL);
+                                       xmlOutputBufferClose(outbuf);
+                                       RETVAL_TRUE;
                                }
-
-                               xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, NULL);
-                               xmlOutputBufferClose(outbuf);
-                               RETURN_TRUE;
                        }
+                       if (filename_type == IS_UNICODE) {
+                               efree(filename);
+                       }
+                       return;
                } else {
                        RETURN_FALSE;
                }
@@ -1251,11 +1266,24 @@ SXE_METHOD(asXML)
 
 #define SXE_NS_PREFIX(ns) (ns->prefix ? (char*)ns->prefix : "")
 
-static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns)
+static inline void sxe_add_namespace_name(zval *return_value, xmlNsPtr ns TSRMLS_DC)
 {
+       uint prefix_len;
        char *prefix = SXE_NS_PREFIX(ns);
-       if (zend_hash_exists(Z_ARRVAL_P(return_value), prefix, strlen(prefix) + 1) == 0) {
-               add_assoc_string(return_value, prefix, (char*)ns->href, 1);
+
+       prefix_len = strlen(prefix) + 1;
+
+       if (zend_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;
+                       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);
+               } else {
+                       add_assoc_string_ex(return_value, prefix, prefix_len, (char*)ns->href, 1);
+               }
        }
 }
 
@@ -1264,13 +1292,13 @@ static void sxe_add_namespaces(php_sxe_object *sxe, xmlNodePtr node, zend_bool r
        xmlAttrPtr  attr;
 
        if (node->ns) { 
-               sxe_add_namespace_name(return_value, node->ns);
+               sxe_add_namespace_name(return_value, node->ns TSRMLS_CC);
        }
 
        attr = node->properties;
        while (attr) {
                if (attr->ns) { 
-                       sxe_add_namespace_name(return_value, attr->ns);
+                       sxe_add_namespace_name(return_value, attr->ns TSRMLS_CC);
                }
                attr = attr->next;
        }
@@ -1309,7 +1337,7 @@ SXE_METHOD(getNamespaces)
                if (node->type == XML_ELEMENT_NODE) {
                        sxe_add_namespaces(sxe, node, recursive, return_value TSRMLS_CC);
                } else if (node->type == XML_ATTRIBUTE_NODE && node->ns) {
-                       sxe_add_namespace_name(return_value, node->ns);
+                       sxe_add_namespace_name(return_value, node->ns TSRMLS_CC);
                }
 next_iter:
                node = node->next;
@@ -1324,7 +1352,7 @@ static void sxe_add_registered_namespaces(php_sxe_object *sxe, xmlNodePtr node,
        if (node->type == XML_ELEMENT_NODE) {
                ns = node->nsDef;
                while (ns != NULL) {
-                       sxe_add_namespace_name(return_value, ns);
+                       sxe_add_namespace_name(return_value, ns TSRMLS_CC);
                        ns = ns->next;
                }
                if (recursive) {
@@ -1357,7 +1385,7 @@ SXE_METHOD(getDocNamespaces)
 }
 /* }}} */
 
-/* {{{ proto object SimpleXMLElement::children([string ns [, bool is_prefix]])
+/* {{{ proto object SimpleXMLElement::children([string ns [, bool is_prefix]]) U
    Finds children of given node */
 SXE_METHOD(children)
 {
@@ -1367,7 +1395,7 @@ SXE_METHOD(children)
        xmlNodePtr      node;
        zend_bool       isprefix = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &nsprefix, &nsprefix_len, &isprefix) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!&b", &nsprefix, &nsprefix_len, UG(utf8_conv), &isprefix) == FAILURE) {
                return;
        }
 
@@ -1385,7 +1413,7 @@ SXE_METHOD(children)
 }
 /* }}} */
 
-/* {{{ proto object SimpleXMLElement::getName()
+/* {{{ proto object SimpleXMLElement::getName() U
    Finds children of given node */
 SXE_METHOD(getName)
 {
@@ -1398,11 +1426,11 @@ SXE_METHOD(getName)
        GET_NODE(sxe, node);
        
        namelen = xmlStrlen(node->name);
-       RETURN_ASCII_STRINGL((char*)node->name, namelen, 1);
+       RETVAL_XML_STRING_LEN((char *) node->name, namelen, ZSTR_DUPLICATE);
 }
 /* }}} */
 
-/* {{{ proto array SimpleXMLElement::attributes([string ns [, bool is_prefix]])
+/* {{{ proto array SimpleXMLElement::attributes([string ns [, bool is_prefix]]) U
    Identifies an element's attributes */
 SXE_METHOD(attributes)
 {
@@ -1412,7 +1440,7 @@ SXE_METHOD(attributes)
        xmlNodePtr      node;
        zend_bool       isprefix = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!b", &nsprefix, &nsprefix_len, &isprefix) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!&b", &nsprefix, &nsprefix_len, UG(utf8_conv), &isprefix) == FAILURE) {
                return;
        }
 
@@ -1429,7 +1457,7 @@ SXE_METHOD(attributes)
 }
 /* }}} */
 
-/* {{{ proto void SimpleXMLElement::addChild(string qName [, string value [, string ns]])
+/* {{{ proto void SimpleXMLElement::addChild(string qName [, string value [, string ns]]) U
    Add Element with optional namespace information */
 SXE_METHOD(addChild)
 {
@@ -1440,8 +1468,8 @@ SXE_METHOD(addChild)
        xmlNsPtr        nsptr = NULL;
        xmlChar        *localname, *prefix = NULL;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!s!",
-               &qname, &qname_len, &value, &value_len, &nsuri, &nsuri_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&|s!&s!&",
+               &qname, &qname_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv), &nsuri, &nsuri_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -1484,7 +1512,7 @@ SXE_METHOD(addChild)
 }
 /* }}} */
 
-/* {{{ proto void SimpleXMLElement::addAttribute(string qName, string value [,string ns])
+/* {{{ proto void SimpleXMLElement::addAttribute(string qName, string value [,string ns]) U
    Add Attribute with optional namespace information */
 SXE_METHOD(addAttribute)
 {
@@ -1496,8 +1524,8 @@ SXE_METHOD(addAttribute)
        xmlNsPtr        nsptr = NULL;
        xmlChar        *localname, *prefix = NULL;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s!",
-               &qname, &qname_len, &value, &value_len, &nsuri, &nsuri_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&s&|s!&",
+               &qname, &qname_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv), &nsuri, &nsuri_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -1556,11 +1584,7 @@ SXE_METHOD(addAttribute)
 static int cast_object(zval *object, int type, char *contents TSRMLS_DC)
 {
        if (contents) {
-               if (UG(unicode)) {
-                       ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), object, contents, 1);
-               } else {
-                       ZVAL_STRINGL(object, contents, strlen(contents), 1);
-               }
+               ZVAL_XML_STRING(object, contents, ZSTR_DUPLICATE);
        } else {
                ZVAL_NULL(object);
        }
@@ -1830,7 +1854,7 @@ sxe_object_new(zend_class_entry *ce TSRMLS_DC)
 }
 /* }}} */
 
-/* {{{ proto simplemxml_element simplexml_load_file(string filename [, string class_name [, int options [, string ns [, bool is_prefix]]]])
+/* {{{ proto simplemxml_element simplexml_load_file(string filename [, string class_name [, int options [, string ns [, bool is_prefix]]]]) U
    Load a filename and return a simplexml_element object to allow for processing */
 PHP_FUNCTION(simplexml_load_file)
 {
@@ -1843,13 +1867,25 @@ PHP_FUNCTION(simplexml_load_file)
        long            options = 0;
        zend_class_entry *ce= sxe_class_entry;
        zend_bool       isprefix = 0;
+       zend_uchar      filename_type;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!lsb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|C!ls&b", &filename, &filename_len, &filename_type, &ce, &options, &ns, &ns_len, UG(utf8_conv), &isprefix) == FAILURE) {
                return;
        }
 
+       if (filename_type == IS_UNICODE) {
+               if (php_stream_path_encode(NULL, &filename, &filename_len, (UChar*)filename, filename_len, REPORT_ERRORS, NULL) == FAILURE) {
+                       zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Could not encode filename", 0 TSRMLS_CC);
+                       return;
+               }
+       }
+
        docp = xmlReadFile(filename, NULL, options);
 
+       if (filename_type == IS_UNICODE) {
+               efree(filename);
+       }
+
        if (! docp) {
                RETURN_FALSE;
        }
@@ -1868,7 +1904,7 @@ PHP_FUNCTION(simplexml_load_file)
 }
 /* }}} */
 
-/* {{{ proto simplemxml_element simplexml_load_string(string data [, string class_name [, int options [, string ns [, bool is_prefix]]]])
+/* {{{ proto simplemxml_element simplexml_load_string(string data [, string class_name [, int options [, string ns [, bool is_prefix]]]]) U
    Load a string and return a simplexml_element object to allow for processing */
 PHP_FUNCTION(simplexml_load_string)
 {
@@ -1882,7 +1918,7 @@ PHP_FUNCTION(simplexml_load_string)
        zend_class_entry *ce= sxe_class_entry;
        zend_bool       isprefix = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!lsb", &data, &data_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|C!ls&b", &data, &data_len, &ce, &options, &ns, &ns_len, UG(utf8_conv), &isprefix) == FAILURE) {
                return;
        }
 
@@ -1907,7 +1943,7 @@ PHP_FUNCTION(simplexml_load_string)
 /* }}} */
 
 
-/* {{{ proto SimpleXMLElement::__construct(string data [, int options [, bool data_is_url [, string ns [, bool is_prefix]]]])
+/* {{{ proto SimpleXMLElement::__construct(string data [, int options [, bool data_is_url [, string ns [, bool is_prefix]]]]) U
    SimpleXMLElement constructor */
 SXE_METHOD(__construct)
 {
@@ -1917,17 +1953,34 @@ SXE_METHOD(__construct)
        xmlDocPtr       docp;
        long            options = 0;
        zend_bool       is_url = 0, isprefix = 0;
+       zend_uchar      data_type;
 
        php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) TSRMLS_CC);
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lbsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|lbs&b", &data, &data_len, &data_type, &options, &is_url, &ns, &ns_len, UG(utf8_conv), &isprefix) == FAILURE) {
                php_std_error_handling();
                return;
        }
 
        php_std_error_handling();
 
+       if (data_type == IS_UNICODE) {
+               if (is_url) {
+                       if (php_stream_path_encode(NULL, &data, &data_len, (UChar*)data, data_len, REPORT_ERRORS, NULL) == FAILURE) {
+                               zend_throw_exception(zend_exception_get_default(TSRMLS_C), "String could not be parsed as XML", 0 TSRMLS_CC);
+                               return;
+                       }
+               } else {
+                       zend_throw_exception(zend_exception_get_default(TSRMLS_C), "SimpleXMLElement can only parse a binary string", 0 TSRMLS_CC);
+                       return;
+               }
+       }
+
        docp = is_url ? xmlReadFile(data, NULL, options) : xmlReadMemory(data, data_len, NULL, NULL, options);
 
+       if (is_url && data_type == IS_UNICODE) {
+               efree(data);
+       }
+
        if (!docp) {
                ((php_libxml_node_object *)sxe)->document = NULL;
                zend_throw_exception(zend_exception_get_default(TSRMLS_C), "String could not be parsed as XML", 0 TSRMLS_CC);
@@ -2080,12 +2133,12 @@ static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_ke
                int u_len;
 
                namelen = xmlStrlen(curnode->name);
-               zend_string_to_unicode_ex(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &str_key->u, &u_len, (char*)curnode->name, namelen, &status);
+               zend_string_to_unicode_ex(UG(utf8_conv), &str_key->u, &u_len, (char*)curnode->name, namelen, &status);
                *str_key_len = u_len + 1;
                return HASH_KEY_IS_UNICODE;
        } else {
                namelen = xmlStrlen(curnode->name);
-               str_key->s = estrndup(curnode->name, namelen);
+               str_key->s = estrndup((char *)curnode->name, namelen);
                *str_key_len = namelen + 1;
                return HASH_KEY_IS_STRING;
        }
@@ -2134,7 +2187,7 @@ void *simplexml_export_node(zval *object TSRMLS_DC)
        return php_sxe_get_first_node(sxe, node TSRMLS_CC);     
 }
 
-/* {{{ proto simplemxml_element simplexml_import_dom(domNode node [, string class_name])
+/* {{{ proto simplemxml_element simplexml_import_dom(domNode node [, string class_name]) U
    Get a simplexml_element object from dom to allow for processing */
 PHP_FUNCTION(simplexml_import_dom)
 {
index 6d1679faa49d35de4ff77658982e9c7ed4eff1b0..f761f3740b323cb3af7ceb5bafffaa065723a158 100644 (file)
@@ -5,7 +5,7 @@ SimpleXML: clone
 --FILE--
 <?php 
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index 9cb5c0e5dcf4b2684abb61ef4efe228649df19df..75376a1538b767df387de3e8412e438fe0ba1a39 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: Entities
 --FILE--
 <?php 
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd" [
 <!ENTITY included-entity "This is text included from an entity">
index bb5916440beaeebc286a6c43477b567f332b0959..a94003422c8c107ca75a295bb8a50cf9ed80d8ce 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: CDATA
 --FILE--
 <?php 
 
-$sxe = simplexml_load_string(<<<EOF
+$sxe = simplexml_load_string(b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index fc24b903aca19b5c0699e0d076d932d5ccf1d64f..035d66b5455f8d11befc773942f89f43d8f16bd9 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: Text data
 --FILE--
 <?php 
 
-$sxe = simplexml_load_string(<<<EOF
+$sxe = simplexml_load_string(b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index 372f38fb036d03f92e7739d8037ad3f3477b5230..b97b71f845e2ea498ec9b4b12d08b80dd077a190 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: foreach
 --FILE--
 <?php 
 
-$sxe = simplexml_load_string(<<<EOF
+$sxe = simplexml_load_string(b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index 5a2cf6f9c0566b0b9585f73c54e3fb6c3366a5f1..67089477901d98d6e203bc3ad408d2745c599ded 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: Attributes
 --FILE--
 <?php 
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index aaa2759acab3626c9b3b3c0abf8448ba09db948c..82dc7832763afe0955c0956af73e66e57dc8ea4a 100644 (file)
@@ -5,7 +5,7 @@ SimpleXML: XPath
 --FILE--
 <?php 
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index 7663f6a92b1980dc9ed89bb981a2fb1f9e09b084..d5cd99910ee94bc7b74d1241bf10e845ac2c3c73 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: foreach
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$sxe = simplexml_load_string(<<<EOF
+$sxe = simplexml_load_string(b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index 3695d34dfcd9d37bf17bb4026c5acb7a34c4048a..de3c522d3a19b76d4061a288e6f01dd6199ad03e 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: foreach
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$sxe = simplexml_load_string(<<<EOF
+$sxe = simplexml_load_string(b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index 5318a525a37ef21c445dcb0e99fc2c2b19ebbcf5..0b4da340fcf69349f442c664236195cf337ea57d 100644 (file)
@@ -9,7 +9,7 @@ class simplexml_inherited extends SimpleXMLElement
 {
 }
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index 74ea4705cad0838ac6243b314d8024dde1e9503e..4404031f33bf32bb4da3b9176698f3191dff6da5 100755 (executable)
@@ -7,7 +7,7 @@ SimpleXML: echo/print
 --FILE--
 <?php 
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <foo>
   <bar>bar</bar>
index 2fc9bec41e2b832b51f7b8d019690e745976312c..f02c3fb16743f2c5f5e00d38545c2dd698c9d925 100755 (executable)
@@ -7,7 +7,7 @@ SimpleXML: Attribute creation
 --FILE--
 <?php 
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <foo/>
 EOF;
index bfb91dbcf940ba7aeafe3bc0bc732951de0d4209..1ce464766cacc6932a487a70068d336eb97a2df1 100755 (executable)
@@ -7,7 +7,7 @@ SimpleXML: Split text content
 --FILE--
 <?php 
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <foo>bar<baz/>bar</foo>
 EOF;
index ba5097598bcf7e3a16a9b616b02e0669625bbaa1..0342ee972b1f331c4ead4fc59f4faafb76f6a8a9 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML: adding/removing attributes (direct)
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
    <person name="Joe"></person>
 </people>
index 59315f884e08850a2411072bef72d4081a537cfd..aa4eaa4ffbe7d83d7f0685c6c9182541cb7982f1 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: adding/removing attributes (single)
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
    <person name="Joe"></person>
 </people>
index 04bcb75224fa64e81db2e8a75eec9cdc1541cf2e..155dfa6db12eb172e4a498ecbd00f80ff0f930af 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: adding/removing attributes (second)
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
    <person name="Joe"></person>
    <person name="Boe"></person>
index aa827d72d8a13f037d5820771249fc34d7fe9b70..2b3f7d18aeb8403a48bb6a71192d680d18af7193 100644 (file)
@@ -4,13 +4,13 @@ SimpleXML: accessing singular subnode as array
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
    <person name="Joe"></person>
 </people>
 EOF;
 
-$xml2 =<<<EOF
+$xml2 =b<<<EOF
 <people>
    <person name="Joe"></person>
    <person name="Boe"></person>
index 87b9a0ef9826fb81127a96323f1edb1733af6650..529f515d0beb4c5a4f2dbba7582adf96fef87a01 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML: modifying attributes of singular subnode
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
    <person name="Joe"></person>
 </people>
index aa9ad53064cb1aca8ede2f60ba23427a663e1d02..6ef8d917d9face33f32bbcb732973dfa2cfa30f7 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: concatenating attributes
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
    <person name="Foo"></person>
 </people>
index 776b00c78544076ae1928a2021bd172f604e3017..8927bdde48cbf8629bf0990881668dbec2e4dc8a 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML: iteration through subnodes
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
    <person name="Joe">
      <child name="Ann" />
@@ -16,7 +16,7 @@ $xml =<<<EOF
    </person>
 </people>
 EOF;
-$xml1 =<<<EOF
+$xml1 =b<<<EOF
 <people>
    <person name="Joe">
      <child name="Ann" />
index e5c810944e915189b10130d349c0eb869d6c3bf5..9e1bd41c4fe3f8cf1a6ccd1ae3d65de741406db9 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML: iteration through subnodes and attributes
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
    <person name="Joe">
      Text1
@@ -19,7 +19,7 @@ $xml =<<<EOF
    </person>
 </people>
 EOF;
-$xml1 =<<<EOF
+$xml1 =b<<<EOF
 <people>
    <person name="Joe">
      <child />
index 2f58707d7d63ae3f4e01faad0f7b216a22a738b2..d69ba5f6589e9633179ec161877653b0355022ea 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: foreach with children()
 --FILE--
 <?php 
 
-$sxe = simplexml_load_string(<<<EOF
+$sxe = simplexml_load_string(b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE sxe SYSTEM "notfound.dtd">
 <sxe id="elem1">
index 9e91b5ac3a976cff8250c87b57fe94cf4d9450a7..7b55d700749232a58ab1c0bf1bf44abeea4d65f4 100755 (executable)
@@ -4,8 +4,7 @@ SimpleXML: Attribute compared to string
 <?php if (!extension_loaded("simplexml")) print "skip"; ?> 
 --FILE--
 <?php
-
-$doc = simplexml_load_string('<root><name attr="foo">bar</name></root>');
+$doc = simplexml_load_string(b'<root><name attr="foo">bar</name></root>');
 print $doc->name["attr"];
 print "\n";
 if ($doc->name["attr"] == "foo") {
index d5138685f5e12da0a400d66ea19a3cbec3b9c278..7493975ee1b353cdca6dffef899ef28c648dd43e 100644 (file)
@@ -6,7 +6,7 @@ SimpleXML: Element check
 <?php
 
 $ok = 1;
-$doc = simplexml_load_string('<root><exists>foo</exists></root>');
+$doc = simplexml_load_string(b'<root><exists>foo</exists></root>');
 if(!isset($doc->exists)) {
        $ok *= 0;
 }
index 5374bbaa2d5775a1196ff6ddc3a39b1fc487ff68..a3586f1b395d170efaee11efb6aaf7c25aac71ac 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: Attributes inside foreach
 --FILE--
 <?php 
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <pres><content><file glob="slide_*.xml"/></content></pres>
 EOF;
index be82b78f3829c47e7727ea55f629240509b71961..1aa47b3be44eaf67db9822405a899129a4bf5654 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: Attributes with entities
 --FILE--
 <?php 
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <!DOCTYPE talks SYSTEM "nbsp.dtd" [
 <!ELEMENT root  EMPTY>
index 018d7e50b6c2ca76caaf94dbec012671a56f004e..7cbe3d43e1e9479d6217675f7ced05b21f72ec44 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: XPath and attributes
 --FILE--
 <?php
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <root>
 <elem attr1='11' attr2='12' attr3='13'/>
index 8579a1e09f272dcf643712a92a58166fdf390243..e763d6e22e62cc17a3abd1f8a1e4fcdb462e4957 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: getting namespaces
 --FILE--
 <?php
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <xhtml:html xmlns:html='http://www.w3.org/1999/xhtml' xmlns:xhtml='http://www.w3.org/TR/REC-html40'>
 <xhtml:head><xhtml:title xmlns:xhtml='http://www.w3.org/TR/REC-html401'>bla</xhtml:title></xhtml:head>
@@ -23,7 +23,7 @@ var_dump($sxe->getNamespaces(true));
 var_dump($sxe->getDocNamespaces());
 var_dump($sxe->getDocNamespaces(true));
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <html xmlns='http://www.w3.org/1999/xhtml'>
 <head><title xmlns='http://www.w3.org/TR/REC-html40'>bla</title></head>
@@ -35,7 +35,7 @@ $sxe = simplexml_load_string($xml);
 var_dump($sxe->getNamespaces());
 var_dump($sxe->getDocNamespaces());
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version='1.0'?>
 <root/>
 EOF;
@@ -93,39 +93,39 @@ array(0) {
 --UEXPECTF--
 array(1) {
   [u"xhtml"]=>
-  string(31) "http://www.w3.org/TR/REC-html40"
+  unicode(31) "http://www.w3.org/TR/REC-html40"
 }
 array(3) {
   [u"xhtml"]=>
-  string(31) "http://www.w3.org/TR/REC-html40"
+  unicode(31) "http://www.w3.org/TR/REC-html40"
   [u"html"]=>
-  string(28) "http://www.w3.org/1999/xhtml"
+  unicode(28) "http://www.w3.org/1999/xhtml"
   [u"foo"]=>
-  string(6) "foobar"
+  unicode(6) "foobar"
 }
 array(2) {
   [u"html"]=>
-  string(28) "http://www.w3.org/1999/xhtml"
+  unicode(28) "http://www.w3.org/1999/xhtml"
   [u"xhtml"]=>
-  string(31) "http://www.w3.org/TR/REC-html40"
+  unicode(31) "http://www.w3.org/TR/REC-html40"
 }
 array(4) {
   [u"html"]=>
-  string(28) "http://www.w3.org/1999/xhtml"
+  unicode(28) "http://www.w3.org/1999/xhtml"
   [u"xhtml"]=>
-  string(31) "http://www.w3.org/TR/REC-html40"
+  unicode(31) "http://www.w3.org/TR/REC-html40"
   [u"foo"]=>
-  string(6) "foobar"
+  unicode(6) "foobar"
   [u"baz"]=>
-  string(9) "foobarbaz"
+  unicode(9) "foobarbaz"
 }
 array(1) {
   [u""]=>
-  string(28) "http://www.w3.org/1999/xhtml"
+  unicode(28) "http://www.w3.org/1999/xhtml"
 }
 array(1) {
   [u""]=>
-  string(28) "http://www.w3.org/1999/xhtml"
+  unicode(28) "http://www.w3.org/1999/xhtml"
 }
 array(0) {
 }
index d6de94be3d1c7937dc11d93d6fe8d304be8cc980..fb5f85c850e3ef8b1110826c91cfa4733a31a97a 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: getName()
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
   <person>Jane</person>
 </people>
index f32786c7cc296d642e54cc5004f3ca0cf252cd1f..b6d573171ba914b7ff3ad7067f80090dd0c29c77 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: Adding an elements
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people></people>
 EOF;
 
index 753056b9ad837a44056c54e0d104399a68334ec0..422804a48702a26f6845860786a477b3abec447b 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: Adding an elements without text
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people></people>
 EOF;
 
index 1624b12d50ea914c0b4505d447f2f725e7471cb1..0a2fe0e429960317dc836f2958cc639bbc9deb76 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: foreach and count
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
   <person name="Joe"/>
   <person name="John">
index 774a5f14595aebc2540c091e33f590789bdff94a..856bf49f4ebe3da6f46d3f136c65e1f228416883 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML: isset and unset by offset
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <root s:att1="b" att1="a" 
       xmlns:s="urn::test" xmlns:t="urn::test-t">
    <child1>test</child1>
index 28d87b0a38ae678a98e41f90ad4f12c664773b1e..e2816fa207137cf7d48d5bdfcfd8ad9e683ec7cc 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML: addChild and addAttribute
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <root s:att1="b" att1="a" 
       xmlns:s="urn::test" xmlns:t="urn::test-t">
    <child1>test</child1>
index 48bc887ecc17772b236e1e92be0c72f9352c2616..60d9aad152f6177a2c79e258c7a1c057cc4e1c8e 100755 (executable)
@@ -4,7 +4,7 @@ SimpleXML: comparing instances
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
   <person name="Joe"/>
   <person name="John">
@@ -16,7 +16,7 @@ $xml =<<<EOF
 </people>
 EOF;
 
-$xml1 =<<<EOF
+$xml1 =b<<<EOF
 <people>
   <person name="John">
     <children>
index b0ee633881ae38f870314e6580373967e6b9852c..761374424bf18cf4b7905c9ca7cc9e56aeebf6dc 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML: casting instances
 --FILE--
 <?php
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <people>
 test
   <person name="Joe"/>
@@ -18,7 +18,7 @@ test
 </people>
 EOF;
 
-$foo = simplexml_load_string( "<foo />" );
+$foo = simplexml_load_string( b"<foo />" );
 $people = simplexml_load_string($xml);
 
 var_dump((bool)$foo);
index 657c229737d795812f71c4ce2957e8355784545d..a109c63392ac164bcc14d6ab423727992cef9017 100644 (file)
@@ -6,7 +6,7 @@ Bug #26976 (Can not access array elements using array indices)
 <?php
 
 $root = simplexml_load_string(
-'<?xml version="1.0"?>
+b'<?xml version="1.0"?>
 <root>
  <child>a</child>
  <child>b</child>
index 364ca4675fe22743d19e0633ecd5094f553f9bb8..8005da2c3a226c5cbe7325d0ec46a84b30de1346 100755 (executable)
@@ -5,7 +5,7 @@ Bug #27010 (segfault and node text not displayed when returned from children())
 --FILE--
 <?php
 
-$xml=<<<EOF
+$xml=b<<<EOF
 <drinks xmlns:hot="http://www.example.com/hot">
  <hot:drink><hot:name>Coffee</hot:name></hot:drink>
  <hot:drink><hot:name>Tea</hot:name></hot:drink>
index 096ab7a681d5ddf1bac3472f13a634032bd348fd..a9c718b9546e3fd2423435e4a275a626cabb2134 100755 (executable)
@@ -5,13 +5,13 @@ Bug #35785 (SimpleXML memory read error)
 --FILE--
 <?php
 
-$xml = simplexml_load_string("<root></root>");
+$xml = simplexml_load_string(b"<root></root>");
 $xml->bla->posts->name = "FooBar";
 echo $xml->asXML();
 
 echo "===FAIL===\n";
 
-$xml = simplexml_load_string("<root></root>");
+$xml = simplexml_load_string(b"<root></root>");
 $count = count($xml->bla->posts);
 var_dump($count);
 $xml->bla->posts[++$count]->name = "FooBar";
index 835e926fe5c9c1a0576bf1d4d070c5bca8030441..264eb1fbb3d15b457b4bf92401af89fbc6d1ee5e 100644 (file)
@@ -5,7 +5,7 @@ Bug #36611 (assignment to SimpleXML object attribute changes argument type to st
 --FILE--
 <?php
 
-$xml_str = <<<EOD
+$xml_str = b<<<EOD
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <c_fpobel >
   <pos >
index 811b335ed122b0d177457d69de2d416ca7a2787f..572cc35f764c9d3af28a196a58a27e6c091f1d71 100755 (executable)
@@ -14,7 +14,7 @@ class Setting extends ReflectionObject
 {
 }
 
-Reflection::export(simplexml_load_string('<test/>', 'Setting'));
+Reflection::export(simplexml_load_string(b'<test/>', 'Setting'));
 
 Reflection::export(simplexml_load_file('data:,<test/>', 'Setting'));
 
index 1dfad4d60dfb8df864dd38afe0ae5a9c59d82041..feada2f4203d08ef023111b3cf4ad3a4adcc1b9b 100644 (file)
@@ -13,7 +13,7 @@ function iterate($xml)
     }
 }
 
-$xmlstr = "<xml><item>Item 1</item><item>Item 2</item></xml>";
+$xmlstr = b"<xml><item>Item 1</item><item>Item 2</item></xml>";
 $xml = simplexml_load_string($xmlstr);
 iterate($xml->unknown);
 
index d2fcde11c2e4976760a7dcb8d1a778d3e4cd8a91..e2ebf9fcf962471b14437253f1239e39ae0259db 100644 (file)
@@ -6,7 +6,7 @@ Bug #38354 (Unwanted reformatting of XML when using AsXML)
 <?php
 
 $xml = simplexml_load_string(
-'<code>
+b'<code>
        <a href="javascript:alert(\'1\');"><strong>Item Two</strong></a>
 </code>'
 );
index 91b9544f66bc122fc0b076a051eb3c125f92c575..6e957b38df2fe159ffb9490c748a21368ae37deb 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML [profile]: Accessing a simple node
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root>
  <child>Hello</child>
 </root>
index 14b5bb86b28f467e126ca03d7d04a101f19c2f70..e5bcfded888e5d89062e4f86db854d8a1e44ce62 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML [profile]: Accessing an array of subnodes
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root>
  <child>Hello</child>
  <child>World</child>
index 14f1c5fe8886cce91729d4ef2192a08b11e0d14d..93f54a0ea1dddac6c72f7038e7d8d83e034accd6 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML [profile]: Accessing an attribute
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root>
  <child attribute="Sample" />
 </root>
index 27714e992710b7ac9f42412da7a5d9791e4e9ff3..8b88f7483fd0f10a7e9a394d192e8e34f05832cd 100644 (file)
@@ -4,7 +4,7 @@ SimpleXML [profile]: Accessing a namespaced element
 <?php if (!extension_loaded("simplexml")) print "skip"; ?>
 --FILE--
 <?php 
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root xmlns:reserved="reserved-ns">
  <reserved:child>Hello</reserved:child>
 </root>
index f69622118a1ae9ed8b0448a29f311cdfa75907ab..3863937ae6aff6c059853db179488dc3886e4cf0 100644 (file)
@@ -5,7 +5,7 @@ SimpleXML [profile]: Accessing an aliased namespaced element
 --FILE--
 <?php
 error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root xmlns:reserved="reserved-ns">
  <reserved:child>Hello</reserved:child>
 </root>
index e519fa9d642c9f733fb8ab47bcb7bb87d8707145..788787b9abaf4c501e6cd427b64186a68a375e1d 100644 (file)
@@ -5,7 +5,7 @@ SimpleXML [profile]: Accessing a namespaced attribute
 --FILE--
 <?php
 error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root xmlns:reserved="reserved-ns">
  <child reserved:attribute="Sample" />
 </root>
index c8a426927439a62c672e8fa15d984e697d601b12..cb8e8682fbc1bcc3ba14bccf92ba5a808d28dab0 100644 (file)
@@ -5,7 +5,7 @@ SimpleXML [profile]: Accessing an aliased namespaced attribute
 --FILE--
 <?php
 error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root xmlns:reserved="reserved-ns">
  <child reserved:attribute="Sample" />
 </root>
index bbb69b75a8c5c8a45cb83716ae1105a9c459c4f7..e9fa4232a4d731a9acb356cd59149cb6a9a9856c 100644 (file)
@@ -5,7 +5,7 @@ SimpleXML [profile]: Accessing a namespaced attribute without a namespace
 --FILE--
 <?php
 error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root xmlns:reserved="reserved-ns">
  <child reserved:attribute="Sample" />
 </root>
index 714572df1efb9b64dcb45fcbb9e0e87adc86fab2..2fec3afb2e8437828386e9a4236b461f48325a69 100644 (file)
@@ -5,7 +5,7 @@ SimpleXML [profile]: Accessing a namespaced element without a namespace
 --FILE--
 <?php
 error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root xmlns:reserved="reserved-ns">
  <reserved:child>Hello</reserved:child>
 </root>
index 6ef7456c51ea24153a379c64de476c37fa2a9137..95312b02f2367a4ce5aa363e27cc18adf22d93a8 100644 (file)
@@ -5,7 +5,7 @@ SimpleXML [profile]: Accessing two attributes with the same name, but different
 --FILE--
 <?php
 error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
  <child reserved:attribute="Sample" special:attribute="Test" />
 </root>
index c2001e9510958a4d8769f81558816f55ff85b257..adad1b6783369caf868a1985e1f13d2fbbd943e8 100644 (file)
@@ -5,7 +5,7 @@ SimpleXML [profile]: Accessing two elements with the same name, but different na
 --FILE--
 <?php
 error_reporting(E_ALL & ~E_NOTICE);
-$root = simplexml_load_string('<?xml version="1.0"?>
+$root = simplexml_load_string(b'<?xml version="1.0"?>
 <root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
  <reserved:child>Hello</reserved:child>
  <special:child>World</special:child>
index d875ce97f44f75763ae1a648f10f7d02b7d3cb8f..607aa6aa5d47820a6ae9db57a500dceac2dec518 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML [profile]: Accessing namespaced root and non namespaced children
 --FILE--
 <?php
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
@@ -75,7 +75,7 @@ object(SimpleXMLElement)#%s (2) {
 --UEXPECTF--
 array(1) {
   [u"soap"]=>
-  string(41) "http://schemas.xmlsoap.org/soap/envelope/"
+  unicode(41) "http://schemas.xmlsoap.org/soap/envelope/"
 }
 object(SimpleXMLElement)#%s (0) {
 }
index 957c6ec659bb6b283d701a66cb8032766c6b87ac..bbea00298445a3aeb88a347613b44bdc3e9e8503 100755 (executable)
@@ -5,7 +5,7 @@ SimpleXML [profile]: Accessing by namespace prefix
 --FILE--
 <?php
 
-$xml =<<<EOF
+$xml =b<<<EOF
 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"