rrichards               Fri Aug  4 18:11:28 2006 UTC

  Modified files:              
    /php-src/ext/dom    attr.c cdatasection.c characterdata.c comment.c 
                        document.c documentfragment.c domimplementation.c 
                        element.c entity.c entityreference.c 
                        namednodemap.c node.c notation.c 
                        processinginstruction.c text.c xpath.c 
    /php-src/ext/dom/tests      bug34276.phpt 
  Log:
  add unicode support
  update test
  
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/attr.c?r1=1.23&r2=1.24&diff_format=u
Index: php-src/ext/dom/attr.c
diff -u php-src/ext/dom/attr.c:1.23 php-src/ext/dom/attr.c:1.24
--- php-src/ext/dom/attr.c:1.23 Wed May  3 08:40:52 2006
+++ php-src/ext/dom/attr.c      Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: attr.c,v 1.23 2006/05/03 08:40:52 rrichards Exp $ */
+/* $Id: attr.c,v 1.24 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -55,12 +55,12 @@
        int name_len, value_len, name_valid;
 
        php_set_error_handling(EH_THROW, dom_domexception_class_entry 
TSRMLS_CC);
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os|s", &id, dom_attr_class_entry, &name, &name_len, &value, &value_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&|s&", &id, dom_attr_class_entry, &name, &name_len, UG(utf8_conv), &value, 
&value_len, UG(utf8_conv)) == FAILURE) {
                php_std_error_handling();
                return;
        }
-
        php_std_error_handling();
+
        intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
 
        name_valid = xmlValidateName((xmlChar *) name, 0);
@@ -69,7 +69,7 @@
                RETURN_FALSE;
        }
 
-       nodep = xmlNewProp(NULL, (xmlChar *) name, value);
+       nodep = xmlNewProp(NULL, (xmlChar *) name, (xmlChar *) value);
 
        if (!nodep) {
                php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC);
@@ -105,7 +105,7 @@
        }
 
        ALLOC_ZVAL(*retval);
-       ZVAL_STRING(*retval, (char *) (attrp->name), 1);
+       ZVAL_XML_STRING(*retval, (char *) (attrp->name), ZSTR_DUPLICATE);
 
        return SUCCESS;
 }
@@ -152,10 +152,10 @@
 
        
        if ((content = xmlNodeGetContent((xmlNodePtr) attrp)) != NULL) {
-               ZVAL_STRING(*retval, content, 1);
+               ZVAL_XML_STRING(*retval, (char *)content, ZSTR_DUPLICATE);
                xmlFree(content);
        } else {
-               ZVAL_EMPTY_STRING(*retval);
+               ZVAL_EMPTY_TEXT(*retval);
        }
 
        return SUCCESS;
@@ -184,10 +184,10 @@
                        zval_copy_ctor(&value_copy);
                        newval = &value_copy;
                }
-               convert_to_string(newval);
+               convert_to_string_with_converter(newval, UG(utf8_conv));
        }
 
-       xmlNodeSetContentLen((xmlNodePtr) attrp, Z_STRVAL_P(newval), 
Z_STRLEN_P(newval) + 1);
+       xmlNodeSetContentLen((xmlNodePtr) attrp, (xmlChar *) 
Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
 
        if (newval == &value_copy) {
                zval_dtor(newval);
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/cdatasection.c?r1=1.14&r2=1.15&diff_format=u
Index: php-src/ext/dom/cdatasection.c
diff -u php-src/ext/dom/cdatasection.c:1.14 php-src/ext/dom/cdatasection.c:1.15
--- php-src/ext/dom/cdatasection.c:1.14 Mon Feb 13 10:23:57 2006
+++ php-src/ext/dom/cdatasection.c      Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: cdatasection.c,v 1.14 2006/02/13 10:23:57 dmitry Exp $ */
+/* $Id: cdatasection.c,v 1.15 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -51,12 +51,12 @@
        int value_len;
 
        php_set_error_handling(EH_THROW, dom_domexception_class_entry 
TSRMLS_CC);
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_cdatasection_class_entry, &value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_cdatasection_class_entry, &value, &value_len, UG(utf8_conv)) == 
FAILURE) {
                php_std_error_handling();
                return;
        }
-
        php_std_error_handling();
+
        nodep = xmlNewCDataBlock(NULL, (xmlChar *) value, value_len);
 
        if (!nodep) {
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/characterdata.c?r1=1.18&r2=1.19&diff_format=u
Index: php-src/ext/dom/characterdata.c
diff -u php-src/ext/dom/characterdata.c:1.18 
php-src/ext/dom/characterdata.c:1.19
--- php-src/ext/dom/characterdata.c:1.18        Mon Feb 13 10:23:57 2006
+++ php-src/ext/dom/characterdata.c     Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: characterdata.c,v 1.18 2006/02/13 10:23:57 dmitry Exp $ */
+/* $Id: characterdata.c,v 1.19 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -64,10 +64,10 @@
        ALLOC_ZVAL(*retval);
        
        if ((content = xmlNodeGetContent(nodep)) != NULL) {
-               ZVAL_STRING(*retval, content, 1);
+               ZVAL_XML_STRING(*retval, content, ZSTR_DUPLICATE);
                xmlFree(content);
        } else {
-               ZVAL_EMPTY_STRING(*retval);
+               ZVAL_EMPTY_TEXT(*retval);
        }
 
        return SUCCESS;
@@ -91,7 +91,7 @@
                        zval_copy_ctor(&value_copy);
                        newval = &value_copy;
                }
-               convert_to_string(newval);
+               convert_to_string_with_converter(newval, UG(utf8_conv));
        }
 
        xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
@@ -181,10 +181,10 @@
        xmlFree(cur);
 
        if (substring) {
-               RETVAL_STRING(substring, 1);
+               RETVAL_XML_STRING(substring, ZSTR_DUPLICATE);
                xmlFree(substring);
        } else {
-               RETVAL_EMPTY_STRING();
+               RETVAL_EMPTY_TEXT();
        }
 }
 /* }}} end dom_characterdata_substring_data */
@@ -202,7 +202,7 @@
        char *arg;
        int arg_len;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_characterdata_class_entry, &arg, &arg_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_characterdata_class_entry, &arg, &arg_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -229,7 +229,7 @@
        int         length, arg_len;
        dom_object      *intern;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Ols", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len) == FAILURE) 
{
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Ols&", &id, dom_characterdata_class_entry, &offset, &arg, &arg_len, 
UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -334,7 +334,7 @@
        int         length, arg_len;
        dom_object      *intern;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Olls", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Olls&", &id, dom_characterdata_class_entry, &offset, &count, &arg, &arg_len, 
UG(utf8_conv)) == FAILURE) {
                return;
        }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/comment.c?r1=1.14&r2=1.15&diff_format=u
Index: php-src/ext/dom/comment.c
diff -u php-src/ext/dom/comment.c:1.14 php-src/ext/dom/comment.c:1.15
--- php-src/ext/dom/comment.c:1.14      Mon Feb 13 10:23:57 2006
+++ php-src/ext/dom/comment.c   Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: comment.c,v 1.14 2006/02/13 10:23:57 dmitry Exp $ */
+/* $Id: comment.c,v 1.15 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -51,12 +51,12 @@
        int value_len;
 
        php_set_error_handling(EH_THROW, dom_domexception_class_entry 
TSRMLS_CC);
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"O|s", &id, dom_comment_class_entry, &value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"O|s&", &id, dom_comment_class_entry, &value, &value_len, UG(utf8_conv)) == 
FAILURE) {
                php_std_error_handling();
                return;
        }
-
        php_std_error_handling();
+
        nodep = xmlNewComment((xmlChar *) value);
 
        if (!nodep) {
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/document.c?r1=1.76&r2=1.77&diff_format=u
Index: php-src/ext/dom/document.c
diff -u php-src/ext/dom/document.c:1.76 php-src/ext/dom/document.c:1.77
--- php-src/ext/dom/document.c:1.76     Tue Jun 20 13:21:10 2006
+++ php-src/ext/dom/document.c  Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: document.c,v 1.76 2006/06/20 13:21:10 tony2001 Exp $ */
+/* $Id: document.c,v 1.77 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -194,7 +194,7 @@
        ALLOC_ZVAL(*retval);
 
        if (encoding != NULL) {
-               ZVAL_STRING(*retval, encoding, 1);
+               ZVAL_XML_STRING(*retval, encoding, ZSTR_DUPLICATE);
        } else {
                ZVAL_NULL(*retval);
        }
@@ -221,7 +221,7 @@
                        zval_copy_ctor(&value_copy);
                        newval = &value_copy;
                }
-               convert_to_string(newval);
+               convert_to_string_with_converter(newval, UG(utf8_conv));
        }
 
        handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
@@ -334,7 +334,7 @@
        ALLOC_ZVAL(*retval);
 
        if (version != NULL) {
-               ZVAL_STRING(*retval, version, 1);
+               ZVAL_XML_STRING(*retval, version, ZSTR_DUPLICATE);
        } else {
                ZVAL_NULL(*retval);
        }
@@ -364,7 +364,7 @@
                        zval_copy_ctor(&value_copy);
                        newval = &value_copy;
                }
-               convert_to_string(newval);
+               convert_to_string_with_converter(newval, UG(utf8_conv));
        }
 
        docp->version = xmlStrdup((const xmlChar *) Z_STRVAL_P(newval));
@@ -699,7 +699,7 @@
        ALLOC_ZVAL(*retval);
        url = (char *) docp->URL;
        if (url != NULL) {
-               ZVAL_STRING(*retval, url, 1);
+               ZVAL_XML_STRING(*retval, url, ZSTR_DUPLICATE);
        } else {
                ZVAL_NULL(*retval);
        }
@@ -729,7 +729,7 @@
                        zval_copy_ctor(&value_copy);
                        newval = &value_copy;
                }
-               convert_to_string(newval);
+               convert_to_string_with_converter(newval, UG(utf8_conv));
        }
 
        docp->URL = xmlStrdup((const xmlChar *) Z_STRVAL_P(newval));
@@ -774,7 +774,7 @@
        int ret, name_len, value_len;
        char *name, *value = NULL;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&|s&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv), 
&value, &value_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -836,7 +836,7 @@
        dom_object *intern;
        char *value;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_document_class_entry, &value, &value_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -865,7 +865,7 @@
        dom_object *intern;
        char *value;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_document_class_entry, &value, &value_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -894,7 +894,7 @@
        dom_object *intern;
        char *value;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_document_class_entry, &value, &value_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -923,7 +923,7 @@
        dom_object *intern;
        char *name, *value = NULL;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os|s", &id, dom_document_class_entry, &name, &name_len, &value, &value_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&|s&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv), 
&value, &value_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -959,7 +959,7 @@
        dom_object *intern;
        char *name;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -994,7 +994,7 @@
        int ret, name_len;
        char *name;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -1028,7 +1028,7 @@
        char *name;
        xmlChar *local;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_document_class_entry, &name, &name_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -1101,7 +1101,7 @@
        int errorcode;
        dom_object *intern;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!s|s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len, 
&value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!&s&|s&", &id, dom_document_class_entry, &uri, &uri_len, UG(utf8_conv), 
&name, &name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) 
{
                return;
        }
 
@@ -1165,7 +1165,7 @@
        dom_object *intern;
        int errorcode;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!s", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!&s&", &id, dom_document_class_entry, &uri, &uri_len, UG(utf8_conv), &name, 
&name_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -1228,7 +1228,7 @@
        char *uri, *name;
        xmlChar *local, *nsuri;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Oss", &id, dom_document_class_entry, &uri, &uri_len, &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&s&", &id, dom_document_class_entry, &uri, &uri_len, UG(utf8_conv), &name, 
&name_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -1256,7 +1256,7 @@
        dom_object *intern;
        char *idname;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &idname, &idname_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_document_class_entry, &idname, &idname_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -1327,12 +1327,12 @@
        int encoding_len = 0, version_len = 0, refcount;
 
        php_set_error_handling(EH_THROW, dom_domexception_class_entry 
TSRMLS_CC);
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"O|ss", &id, dom_document_class_entry, &version, &version_len, &encoding, 
&encoding_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"O|s&s&", &id, dom_document_class_entry, &version, &version_len, UG(utf8_conv), 
&encoding, &encoding_len, UG(utf8_conv)) == FAILURE) {
                php_std_error_handling();
                return;
        }
-
        php_std_error_handling();
+
        docp = xmlNewDoc(version);
 
        if (!docp) {
@@ -1531,6 +1531,7 @@
        dom_object *intern;
        char *source;
        int source_len, refcount, ret;
+       zend_uchar source_type = IS_STRING;
        long options = 0;
 
        id = getThis();
@@ -1538,8 +1539,14 @@
                id = NULL;
        }
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, 
&source_len, &options) == FAILURE) {
-               return;
+       if (mode == DOM_LOAD_FILE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|l", 
&source, &source_len, &source_type, &options) == FAILURE) {
+                       return;
+               }
+       } else {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", 
&source, &source_len, &options) == FAILURE) {
+                       return;
+               }
        }
 
        if (!source_len) {
@@ -1547,8 +1554,18 @@
                RETURN_FALSE;
        }
 
+       if (source_type == IS_UNICODE) {
+               if (php_stream_path_encode(NULL, &source, &source_len, 
(UChar*)source, source_len, REPORT_ERRORS, NULL) == FAILURE) {
+                       RETURN_FALSE;
+               }
+       }
+
        newdoc = dom_document_parser(id, mode, source, options TSRMLS_CC);
 
+       if (source_type == IS_UNICODE) {
+               efree(source);
+       }
+
        if (!newdoc)
                RETURN_FALSE;
 
@@ -1611,9 +1628,10 @@
        dom_object *intern;
        dom_doc_propsptr doc_props;
        char *file;
+       zend_uchar file_type;
        long options = 0;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Ot|l", &id, dom_document_class_entry, &file, &file_len, &file_type, &options) 
== FAILURE) {
                return;
        }
 
@@ -1632,7 +1650,19 @@
                saveempty = xmlSaveNoEmptyTags;
                xmlSaveNoEmptyTags = 1;
        }
+
+       if (file_type == IS_UNICODE) {
+               if (php_stream_path_encode(NULL, &file, &file_len, 
(UChar*)file, file_len, REPORT_ERRORS, NULL) == FAILURE) {
+                       RETURN_FALSE;
+               }
+       }
+
        bytes = xmlSaveFormatFileEnc(file, docp, NULL, format);
+
+       if (file_type == IS_UNICODE) {
+               efree(file);
+       }
+
        if (options & LIBXML_SAVE_NOEMPTYTAG) {
                xmlSaveNoEmptyTags = saveempty;
        }
@@ -1708,7 +1738,7 @@
                if (!size) {
                        RETURN_FALSE;
                }
-               RETVAL_RT_STRINGL(mem, size, 1);
+               RETVAL_STRINGL(mem, size, 1);
                xmlFree(mem);
        }
 }
@@ -1838,9 +1868,16 @@
        xmlSchemaValidCtxtPtr   vptr;
        int                     is_valid;
        char resolved_path[MAXPATHLEN + 1];
+       zend_uchar source_type = IS_STRING;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
-               return;
+       if (type == DOM_LOAD_FILE) {
+               if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
getThis(), "Os", &id, dom_document_class_entry, &source, &source_len, 
&source_type) == FAILURE) {
+                       return;
+               }
+       } else {
+               if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == 
FAILURE) {
+                       return;
+               }
        }
 
        if (source_len == 0) {
@@ -1852,12 +1889,25 @@
 
        switch (type) {
        case DOM_LOAD_FILE:
+               if (source_type == IS_UNICODE) {
+                       if (php_stream_path_encode(NULL, &source, &source_len, 
(UChar*)source, source_len, REPORT_ERRORS, NULL) == FAILURE) {
+                               RETURN_FALSE;
+                       }
+               }
+
                valid_file = _dom_get_valid_file_path(source, resolved_path, 
MAXPATHLEN  TSRMLS_CC);
                if (!valid_file) {
+                       if (source_type == IS_UNICODE) {
+                               efree(source);
+                       }
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 
Schema file source");
                        RETURN_FALSE;
                }
                parser = xmlSchemaNewParserCtxt(valid_file);
+
+               if (source_type == IS_UNICODE) {
+                       efree(source);
+               }
                break;
        case DOM_LOAD_STRING:
                parser = xmlSchemaNewMemParserCtxt(source, source_len);
@@ -1928,9 +1978,16 @@
        xmlRelaxNGValidCtxtPtr  vptr;
        int                     is_valid;
        char resolved_path[MAXPATHLEN + 1];
+       zend_uchar source_type = IS_STRING;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
-               return;
+       if (type == DOM_LOAD_FILE) {
+               if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
getThis(), "Os", &id, dom_document_class_entry, &source, &source_len, 
&source_type) == FAILURE) {
+                       return;
+               }
+       } else {
+               if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == 
FAILURE) {
+                       return;
+               }
        }
 
        if (source_len == 0) {
@@ -1942,12 +1999,23 @@
 
        switch (type) {
        case DOM_LOAD_FILE:
+               if (source_type == IS_UNICODE) {
+                       if (php_stream_path_encode(NULL, &source, &source_len, 
(UChar*)source, source_len, REPORT_ERRORS, NULL) == FAILURE) {
+                               RETURN_FALSE;
+                       }
+               }
                valid_file = _dom_get_valid_file_path(source, resolved_path, 
MAXPATHLEN  TSRMLS_CC);
                if (!valid_file) {
+                       if (source_type == IS_UNICODE) {
+                               efree(source);
+                       }
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 
RelaxNG file source");
                        RETURN_FALSE;
                }
                parser = xmlRelaxNGNewParserCtxt(valid_file);
+               if (source_type == IS_UNICODE) {
+                       efree(source);
+               }
                break;
        case DOM_LOAD_STRING:
                parser = xmlRelaxNGNewMemParserCtxt(source, source_len);
@@ -2017,11 +2085,18 @@
        char *source;
        int source_len, refcount, ret;
        htmlParserCtxtPtr ctxt;
-       
+       zend_uchar source_type = IS_STRING;
+
        id = getThis();
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &source, 
&source_len) == FAILURE) {
-               return;
+       if (mode == DOM_LOAD_FILE) {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", 
&source, &source_len, &source_type) == FAILURE) {
+                       return;
+               }
+       } else {
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", 
&source, &source_len) == FAILURE) {
+                       return;
+               }
        }
 
        if (!source_len) {
@@ -2030,7 +2105,17 @@
        }
 
        if (mode == DOM_LOAD_FILE) {
+               if (source_type == IS_UNICODE) {
+                       if (php_stream_path_encode(NULL, &source, &source_len, 
(UChar*)source, source_len, REPORT_ERRORS, NULL) == FAILURE) {
+                               RETURN_FALSE;
+                       }
+               }
+
                ctxt = htmlCreateFileParserCtxt(source, NULL);
+
+               if (source_type == IS_UNICODE) {
+                       efree(source);
+               }
        } else {
                source_len = xmlStrlen(source);
                ctxt = htmlCreateMemoryParserCtxt(source, source_len);
@@ -2109,6 +2194,7 @@
        dom_object *intern;
        dom_doc_propsptr doc_props;
        char *file;
+       zend_uchar file_type = IS_STRING;
 
        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
                return;
@@ -2121,12 +2207,23 @@
 
        DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
 
+       if (file_type == IS_UNICODE) {
+               if (php_stream_path_encode(NULL, &file, &file_len, 
(UChar*)file, file_len, REPORT_ERRORS, NULL) == FAILURE) {
+                       RETURN_FALSE;
+               }
+       }
+
        /* encoding handled by property on doc */
 
        doc_props = dom_get_doc_props(intern->document);
        format = doc_props->formatoutput;
+
        bytes = htmlSaveFileFormat(file, docp, NULL, format);
 
+       if (file_type == IS_UNICODE) {
+               efree(file);
+       }
+
        if (bytes == -1) {
                RETURN_FALSE;
        }
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/documentfragment.c?r1=1.18&r2=1.19&diff_format=u
Index: php-src/ext/dom/documentfragment.c
diff -u php-src/ext/dom/documentfragment.c:1.18 
php-src/ext/dom/documentfragment.c:1.19
--- php-src/ext/dom/documentfragment.c:1.18     Mon Feb 13 10:23:57 2006
+++ php-src/ext/dom/documentfragment.c  Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: documentfragment.c,v 1.18 2006/02/13 10:23:57 dmitry Exp $ */
+/* $Id: documentfragment.c,v 1.19 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -117,7 +117,7 @@
        int err;
        xmlNodePtr lst;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_documentfragment_class_entry, &data, &data_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_documentfragment_class_entry, &data, &data_len, UG(utf8_conv)) 
== FAILURE) {
                return;
        }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/domimplementation.c?r1=1.19&r2=1.20&diff_format=u
Index: php-src/ext/dom/domimplementation.c
diff -u php-src/ext/dom/domimplementation.c:1.19 
php-src/ext/dom/domimplementation.c:1.20
--- php-src/ext/dom/domimplementation.c:1.19    Fri Feb 24 10:24:43 2006
+++ php-src/ext/dom/domimplementation.c Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: domimplementation.c,v 1.19 2006/02/24 10:24:43 mike Exp $ */
+/* $Id: domimplementation.c,v 1.20 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -77,7 +77,7 @@
        xmlChar *pch1 = NULL, *pch2 = NULL, *localname = NULL;
        xmlURIPtr uri;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sss", &name, 
&name_len, &publicid, &publicid_len, &systemid, &systemid_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s&s&s&", &name, 
&name_len, UG(utf8_conv), &publicid, &publicid_len, UG(utf8_conv), &systemid, 
&systemid_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -136,7 +136,7 @@
        char *prefix = NULL, *localname = NULL;
        dom_object *doctobj;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssO", &uri, 
&uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s&s&O", &uri, 
&uri_len, UG(utf8_conv), &name, &name_len, UG(utf8_conv), &node, 
dom_documenttype_class_entry) == FAILURE) {
                return;
        }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/element.c?r1=1.45&r2=1.46&diff_format=u
Index: php-src/ext/dom/element.c
diff -u php-src/ext/dom/element.c:1.45 php-src/ext/dom/element.c:1.46
--- php-src/ext/dom/element.c:1.45      Tue Jun 13 20:20:03 2006
+++ php-src/ext/dom/element.c   Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: element.c,v 1.45 2006/06/13 20:20:03 iliaa Exp $ */
+/* $Id: element.c,v 1.46 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -72,12 +72,12 @@
        xmlNsPtr nsptr = NULL;
 
        php_set_error_handling(EH_THROW, dom_domexception_class_entry 
TSRMLS_CC);
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os|s!s", &id, dom_element_class_entry, &name, &name_len, &value, &value_len, 
&uri, &uri_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&|s!&s&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv), 
&value, &value_len, UG(utf8_conv), &uri, &uri_len, UG(utf8_conv)) == FAILURE) {
                php_std_error_handling();
                return;
        }
-
        php_std_error_handling();
+
        name_valid = xmlValidateName((xmlChar *) name, 0);
        if (name_valid != 0) {
                php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC);
@@ -161,10 +161,10 @@
                qname = xmlStrdup(ns->prefix);
                qname = xmlStrcat(qname, ":");
                qname = xmlStrcat(qname, nodep->name);
-               ZVAL_STRING(*retval, qname, 1);
+               ZVAL_XML_STRING(*retval, qname, ZSTR_DUPLICATE);
                xmlFree(qname);
        } else {
-               ZVAL_STRING(*retval, (char *) nodep->name, 1);
+               ZVAL_XML_STRING(*retval, (char *) nodep->name, ZSTR_DUPLICATE);
        }
 
        return SUCCESS;
@@ -210,9 +210,9 @@
 
        value = xmlGetProp(nodep, name);
        if (value == NULL) {
-               RETURN_EMPTY_STRING();
+               RETURN_EMPTY_TEXT();
        } else {
-               RETVAL_STRING(value, 1);
+               RETVAL_XML_STRING(value, ZSTR_DUPLICATE);
                xmlFree(value);
        }
 }
@@ -232,8 +232,7 @@
        dom_object *intern;
        char *name, *value;
 
-
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Oss", &id, dom_element_class_entry, &name, &name_len, &value, &value_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&s&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv), &value, 
&value_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -278,7 +277,7 @@
        int name_len;
        char *name;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -322,7 +321,7 @@
        dom_object *intern;
        char *name;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -452,7 +451,7 @@
        char *name;
        xmlChar *local;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -479,7 +478,7 @@
        int uri_len = 0, name_len = 0;
        char *uri, *name, *strattr;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, 
&name_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -488,18 +487,18 @@
        strattr = xmlGetNsProp(elemp, name, uri);
 
        if (strattr != NULL) {
-               RETVAL_STRING(strattr, 1);
+               RETVAL_XML_STRING(strattr, ZSTR_DUPLICATE);
                xmlFree(strattr);
        } else {
                if (xmlStrEqual(uri, DOM_XMLNS_NAMESPACE)) {
                        nsptr = dom_get_nsdecl(elemp, name);
                        if (nsptr != NULL) {
-                               RETVAL_STRING((char *) nsptr->href, 1);
+                               RETVAL_XML_STRING((char *) nsptr->href, 
ZSTR_DUPLICATE);
                        } else {
-                               RETVAL_EMPTY_STRING();
+                               RETVAL_EMPTY_TEXT();
                        }
                } else {
-                       RETVAL_EMPTY_STRING();
+                       RETVAL_EMPTY_TEXT();
                }
        }
 
@@ -559,7 +558,7 @@
        dom_object *intern;
        int errorcode = 0, stricterror, is_xmlns = 0;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!ss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, 
&value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!&s&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, 
&name_len, UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -668,7 +667,7 @@
        int name_len, uri_len;
        char *name, *uri;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, 
&name_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -725,7 +724,7 @@
        int uri_len, name_len, ret;
        char *uri, *name;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, 
&name_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -827,7 +826,7 @@
        char *uri, *name;
        xmlChar *local, *nsuri;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Oss", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, 
&name_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -855,7 +854,7 @@
        char *name, *value;
        int name_len;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_element_class_entry, &name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -885,7 +884,7 @@
        int uri_len, name_len;
        char *uri, *name, *value;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!s", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!&s&", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, 
&name_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -942,7 +941,7 @@
        int name_len;
        zend_bool is_id;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Osb", &id, dom_element_class_entry, &name, &name_len, &is_id) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&b", &id, dom_element_class_entry, &name, &name_len, UG(utf8_conv), &is_id) 
== FAILURE) {
                return;
        }
 
@@ -979,7 +978,7 @@
        char *uri, *name;
        zend_bool is_id;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Ossb", &id, dom_element_class_entry, &uri, &uri_len, &name, &name_len, &is_id) 
== FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&s&b", &id, dom_element_class_entry, &uri, &uri_len, UG(utf8_conv), &name, 
&name_len, UG(utf8_conv), &is_id) == FAILURE) {
                return;
        }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/entity.c?r1=1.10&r2=1.11&diff_format=u
Index: php-src/ext/dom/entity.c
diff -u php-src/ext/dom/entity.c:1.10 php-src/ext/dom/entity.c:1.11
--- php-src/ext/dom/entity.c:1.10       Sun Jan  1 13:09:49 2006
+++ php-src/ext/dom/entity.c    Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: entity.c,v 1.10 2006/01/01 13:09:49 sniper Exp $ */
+/* $Id: entity.c,v 1.11 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -59,7 +59,7 @@
        if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
                ZVAL_NULL(*retval);
        } else {
-               ZVAL_STRING(*retval, (char *) (nodep->ExternalID), 1);
+               ZVAL_XML_STRING(*retval, (char *) (nodep->ExternalID), 
ZSTR_DUPLICATE);
        }
 
        return SUCCESS;
@@ -89,7 +89,7 @@
        if (nodep->etype != XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) {
                ZVAL_NULL(*retval);
        } else {
-               ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
+               ZVAL_XML_STRING(*retval, (char *) (nodep->SystemID), 
ZSTR_DUPLICATE);
        }
 
        return SUCCESS;
@@ -121,7 +121,7 @@
                ZVAL_NULL(*retval);
        } else {
                content = xmlNodeGetContent((xmlNodePtr) nodep);
-               ZVAL_STRING(*retval, content, 1);
+               ZVAL_XML_STRING(*retval, content, ZSTR_DUPLICATE);
                xmlFree(content);
        }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/entityreference.c?r1=1.15&r2=1.16&diff_format=u
Index: php-src/ext/dom/entityreference.c
diff -u php-src/ext/dom/entityreference.c:1.15 
php-src/ext/dom/entityreference.c:1.16
--- php-src/ext/dom/entityreference.c:1.15      Mon Feb 13 10:23:57 2006
+++ php-src/ext/dom/entityreference.c   Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: entityreference.c,v 1.15 2006/02/13 10:23:57 dmitry Exp $ */
+/* $Id: entityreference.c,v 1.16 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -51,11 +51,10 @@
        int name_len, name_valid;
 
        php_set_error_handling(EH_THROW, dom_domexception_class_entry 
TSRMLS_CC);
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_entityreference_class_entry, &name, &name_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_entityreference_class_entry, &name, &name_len, UG(utf8_conv)) 
== FAILURE) {
                php_std_error_handling();
                return;
        }
-
        php_std_error_handling();
 
        name_valid = xmlValidateName((xmlChar *) name, 0);
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/namednodemap.c?r1=1.19&r2=1.20&diff_format=u
Index: php-src/ext/dom/namednodemap.c
diff -u php-src/ext/dom/namednodemap.c:1.19 php-src/ext/dom/namednodemap.c:1.20
--- php-src/ext/dom/namednodemap.c:1.19 Fri Mar  3 20:13:12 2006
+++ php-src/ext/dom/namednodemap.c      Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: namednodemap.c,v 1.19 2006/03/03 20:13:12 rrichards Exp $ */
+/* $Id: namednodemap.c,v 1.20 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -107,7 +107,7 @@
        xmlNodePtr nodep;
        xmlNotation *notep = NULL;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_namednodemap_class_entry, &named, &namedlen) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_namednodemap_class_entry, &named, &namedlen, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -243,7 +243,7 @@
        xmlNodePtr nodep;
        xmlNotation *notep = NULL;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!s", &id, dom_namednodemap_class_entry, &uri, &urilen, &named, &namedlen) == 
FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os!&s&", &id, dom_namednodemap_class_entry, &uri, &urilen, UG(utf8_conv), 
&named, &namedlen, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/node.c?r1=1.46&r2=1.47&diff_format=u
Index: php-src/ext/dom/node.c
diff -u php-src/ext/dom/node.c:1.46 php-src/ext/dom/node.c:1.47
--- php-src/ext/dom/node.c:1.46 Sun Jul 16 16:04:35 2006
+++ php-src/ext/dom/node.c      Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: node.c,v 1.46 2006/07/16 16:04:35 chregu Exp $ */
+/* $Id: node.c,v 1.47 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -150,7 +150,7 @@
        ALLOC_ZVAL(*retval);
 
        if(str != NULL) {
-               ZVAL_RT_STRING(*retval, str, 1);
+               ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
        } else {
                ZVAL_EMPTY_TEXT(*retval);
        }
@@ -205,7 +205,7 @@
        ALLOC_ZVAL(*retval);
 
        if(str != NULL) {
-               ZVAL_RT_STRING(*retval, str, 1);
+               ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
                xmlFree(str);
        } else {
                ZVAL_NULL(*retval);
@@ -245,7 +245,7 @@
                                        zval_copy_ctor(&value_copy);
                                        newval = &value_copy;
                                }
-                               convert_to_string(newval);
+                               convert_to_string_with_converter(newval, 
UG(utf8_conv));
                        }
                        xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), 
Z_STRLEN_P(newval) + 1);
                        if (newval == &value_copy) {
@@ -619,7 +619,7 @@
        ALLOC_ZVAL(*retval);
 
        if(str != NULL) {
-               ZVAL_STRING(*retval, str, 1);
+               ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
        } else {
                ZVAL_NULL(*retval);
        }
@@ -666,9 +666,9 @@
        ALLOC_ZVAL(*retval);
 
        if (str == NULL) {
-               ZVAL_EMPTY_STRING(*retval);
+               ZVAL_EMPTY_TEXT(*retval);
        } else {
-               ZVAL_STRING(*retval, str, 1);
+               ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
        }
        return SUCCESS;
 
@@ -705,7 +705,7 @@
                                        zval_copy_ctor(&value_copy);
                                        newval = &value_copy;
                                }
-                               convert_to_string(newval);
+                               convert_to_string_with_converter(newval, 
UG(utf8_conv));
                        }
                        prefix = Z_STRVAL_P(newval);
                        if (nsnode && nodep->ns != NULL && 
!xmlStrEqual(nodep->ns->prefix, (xmlChar *)prefix)) {
@@ -774,7 +774,7 @@
        ALLOC_ZVAL(*retval);
 
        if (nodep->type == XML_ELEMENT_NODE || nodep->type == 
XML_ATTRIBUTE_NODE || nodep->type == XML_NAMESPACE_DECL) {
-               ZVAL_STRING(*retval, (char *) (nodep->name), 1);
+               ZVAL_XML_STRING(*retval, (char *) (nodep->name), 
ZSTR_DUPLICATE);
        } else {
                ZVAL_NULL(*retval);
        }
@@ -807,7 +807,7 @@
 
        baseuri = xmlNodeGetBase(nodep->doc, nodep);
        if (baseuri) {
-               ZVAL_STRING(*retval, (char *) (baseuri), 1);
+               ZVAL_XML_STRING(*retval, (char *) (baseuri), ZSTR_DUPLICATE);
                xmlFree(baseuri);
        } else {
                ZVAL_NULL(*retval);
@@ -842,10 +842,10 @@
        ALLOC_ZVAL(*retval);
 
        if(str != NULL) {
-               ZVAL_STRING(*retval, str, 1);
+               ZVAL_XML_STRING(*retval, str, ZSTR_DUPLICATE);
                xmlFree(str);
        } else {
-               ZVAL_EMPTY_STRING(*retval);
+               ZVAL_EMPTY_TEXT(*retval);
        }
 
        return SUCCESS;
@@ -1530,7 +1530,7 @@
        int uri_len = 0;
        char *uri;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_node_class_entry, &uri, &uri_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -1558,7 +1558,8 @@
 
                if (lookupp != NULL && (nsptr = xmlSearchNsByHref(lookupp->doc, 
lookupp, uri))) {
                        if (nsptr->prefix != NULL) {
-                               RETURN_STRING((char *) nsptr->prefix, 1);
+                               RETVAL_XML_STRING((char *) nsptr->prefix, 
ZSTR_DUPLICATE);
+                               return;
                        }
                }
        }
@@ -1581,7 +1582,7 @@
        int uri_len = 0;
        char *uri;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_node_class_entry, &uri, &uri_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_node_class_entry, &uri, &uri_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -1612,7 +1613,7 @@
        int prefix_len = 0;
        char *prefix;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_node_class_entry, &prefix, &prefix_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&", &id, dom_node_class_entry, &prefix, &prefix_len, UG(utf8_conv)) == 
FAILURE) {
                return;
        }
 
@@ -1621,7 +1622,8 @@
        if (prefix_len > 0) {
                nsptr = xmlSearchNs(nodep->doc, nodep, prefix);
                if (nsptr && nsptr->href != NULL) {
-                       RETURN_STRING((char *) nsptr->href, 1);
+                       RETVAL_XML_STRING((char *) nsptr->href, ZSTR_DUPLICATE);
+                       return;
                }
        }
 
@@ -1689,6 +1691,7 @@
     xmlOutputBufferPtr buf;
        xmlXPathContextPtr ctxp=NULL;
        xmlXPathObjectPtr xpathobjp=NULL;
+       zend_uchar file_type = IS_STRING;
 
        if (mode == 0) {
                if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
getThis(), 
@@ -1698,7 +1701,7 @@
                }
        } else {
                if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
getThis(), 
-                       "Os|bba!a!", &id, dom_node_class_entry, &file, 
&file_len, &exclusive, 
+                       "Ot|bba!a!", &id, dom_node_class_entry, &file, 
&file_len, &file_type, &exclusive, 
                        &with_comments, &xpath_array, &ns_prefixes) == FAILURE) 
{
                        return;
                }
@@ -1713,6 +1716,12 @@
                RETURN_FALSE;
        }
 
+       if (file_type == IS_UNICODE) {
+               if (php_stream_path_encode(NULL, &file, &file_len, 
(UChar*)file, file_len, REPORT_ERRORS, NULL) == FAILURE) {
+                       RETURN_FALSE;
+               }
+       }
+
        if (xpath_array == NULL) {
                if (nodep->type != XML_DOCUMENT_NODE) {
                        ctxp = xmlXPathNewContext(docp);
@@ -1726,6 +1735,9 @@
                                        xmlXPathFreeObject(xpathobjp);
                                }
                                xmlXPathFreeContext(ctxp);
+                               if (file_type == IS_UNICODE) {
+                                       efree(file);
+                               }
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"XPath query did not return a nodeset.");
                                RETURN_FALSE;
                        }
@@ -1733,13 +1745,24 @@
        } else {
                /*xpath query from xpath_array */
                HashTable *ht = Z_ARRVAL_P(xpath_array);
-               zval **tmp;
+               zval **tmp, **zxquery;
                char *xquery;
+               int xquery_len;
 
                if (zend_hash_find(ht, "query", sizeof("query"), (void**)&tmp) 
== SUCCESS &&
-                   Z_TYPE_PP(tmp) == IS_STRING) {
-                       xquery = Z_STRVAL_PP(tmp);
+                   Z_TYPE_PP(tmp) == IS_STRING || Z_TYPE_PP(tmp) == 
IS_UNICODE) {
+                               zxquery = tmp;
+/*
+                       if (Z_TYPE_PP(tmp) == IS_STRING) {
+                               xquery = Z_STRVAL_PP(tmp);
+                       } else {
+                               
+                       }
+*/
                } else {
+                       if (file_type == IS_UNICODE) {
+                               efree(file);
+                       }
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "'query' 
missing from xpath array or is not a string");
                        RETURN_FALSE;
                }
@@ -1750,26 +1773,66 @@
                if (zend_hash_find(ht, "namespaces", sizeof("namespaces"), 
(void**)&tmp) == SUCCESS &&
                    Z_TYPE_PP(tmp) == IS_ARRAY) {
                        zval **tmpns;
+                       char *nschar;
+                       int nschar_len;
+
                        while (zend_hash_get_current_data(Z_ARRVAL_PP(tmp), 
(void **)&tmpns) == SUCCESS) {
-                               if (Z_TYPE_PP(tmpns) == IS_STRING) {
-                                       char *prefix;
+                               if (Z_TYPE_PP(tmpns) == IS_STRING || 
Z_TYPE_PP(tmpns) == IS_UNICODE) {
+                                       zstr prefix = NULL_ZSTR;
                                        ulong idx;
-                                       int prefix_key_len;
+                                       uint prefix_key_len;
+                                       zend_uchar htype;
+                                       UErrorCode errCode = 0;
+
+                                       if (Z_TYPE_PP(tmpns) == IS_UNICODE) {
+                                               
zend_convert_from_unicode(UG(utf8_conv), &nschar, &nschar_len, 
Z_USTRVAL_PP(tmpns), Z_USTRLEN_PP(tmpns), &errCode);
+                                       } else {
+                                               nschar = Z_STRVAL_PP(tmpns);
+                                       }
+
+                                       htype = 
zend_hash_get_current_key_ex(Z_ARRVAL_PP(tmp), 
+                                               &prefix, &prefix_key_len, &idx, 
0, NULL);
+                                       if (htype == HASH_KEY_IS_STRING) {
+                                               xmlXPathRegisterNs(ctxp, 
(xmlChar *)prefix.s, (xmlChar *)nschar);
+                                       } else
+                                               if (htype == 
HASH_KEY_IS_UNICODE) {
+                                                       char *tmp_prefix;
+                                                       int tmp_prefix_len;
+                                                       errCode = 0;
+
+                                                       
zend_convert_from_unicode(UG(utf8_conv), &tmp_prefix, &tmp_prefix_len, 
prefix.u, prefix_key_len, &errCode);
+                                                       
xmlXPathRegisterNs(ctxp, (xmlChar *)tmp_prefix, (xmlChar *)nschar);
+                                                       efree(tmp_prefix);
+                                               }
 
-                                       if 
(zend_hash_get_current_key_ex(Z_ARRVAL_PP(tmp), 
-                                               &prefix, &prefix_key_len, &idx, 
0, NULL) == HASH_KEY_IS_STRING) {
-                                               xmlXPathRegisterNs(ctxp, 
prefix, Z_STRVAL_PP(tmpns));
+                                       if (Z_TYPE_PP(tmpns) == IS_UNICODE) {
+                                               efree(nschar);
                                        }
                                }
                                zend_hash_move_forward(Z_ARRVAL_PP(tmp));
                        }
                }
 
+               if (Z_TYPE_PP(zxquery) == IS_UNICODE) {
+                       UErrorCode errCode = 0;
+                       zend_convert_from_unicode(UG(utf8_conv), &xquery, 
&xquery_len, Z_USTRVAL_PP(zxquery), Z_USTRLEN_PP(zxquery), &errCode);
+               } else {
+                       xquery = Z_STRVAL_PP(zxquery);
+               }
+
                xpathobjp = xmlXPathEvalExpression(xquery, ctxp);
+
+               if (Z_TYPE_PP(zxquery) == IS_UNICODE) {
+                       efree(xquery);
+               }
+
                ctxp->node = NULL;
                if (xpathobjp && xpathobjp->type == XPATH_NODESET) {
                        nodeset = xpathobjp->nodesetval;
                } else {
+                       if (file_type == IS_UNICODE) {
+                               efree(file);
+                       }
                        if (xpathobjp) {
                                xmlXPathFreeObject(xpathobjp);
                        }
@@ -1788,7 +1851,14 @@
                                sizeof(xmlChar *), 0);
                        while 
(zend_hash_get_current_data(Z_ARRVAL_P(ns_prefixes), (void **)&tmpns) == 
SUCCESS) {
                                if (Z_TYPE_PP(tmpns) == IS_STRING) {
-                                       inclusive_ns_prefixes[nscount++] = 
Z_STRVAL_PP(tmpns);
+                                       inclusive_ns_prefixes[nscount++] = 
estrndup(Z_STRVAL_PP(tmpns), strlen(Z_STRVAL_PP(tmpns)));
+                               } else {
+                                       UErrorCode errCode = 0;
+                                       char *prefix;
+                                       int prfeix_len;
+
+                                       
zend_convert_from_unicode(UG(utf8_conv), &prefix, &prfeix_len, 
Z_USTRVAL_PP(tmpns), Z_USTRLEN_PP(tmpns), &errCode);
+                                       inclusive_ns_prefixes[nscount++] = 
prefix;
                                }
                                zend_hash_move_forward(Z_ARRVAL_P(ns_prefixes));
                        }
@@ -1810,7 +1880,15 @@
                        with_comments, buf);
        }
 
+       if (file_type == IS_UNICODE) {
+               efree(file);
+       }
+
        if (inclusive_ns_prefixes != NULL) {
+               int nscount = 0;
+               while(inclusive_ns_prefixes[nscount] != NULL) {
+                       efree(inclusive_ns_prefixes[nscount++]);
+               }
                efree(inclusive_ns_prefixes);
        }
        if (xpathobjp != NULL) {
@@ -1873,11 +1951,11 @@
        
        DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
 
-       value = xmlGetNodePath(nodep);
+       value = (char *)xmlGetNodePath(nodep);
        if (value == NULL) {
                RETURN_NULL();
        } else {
-               RETVAL_STRING(value, 1);
+               RETVAL_XML_STRING(value, ZSTR_DUPLICATE);
                xmlFree(value);
        }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/notation.c?r1=1.11&r2=1.12&diff_format=u
Index: php-src/ext/dom/notation.c
diff -u php-src/ext/dom/notation.c:1.11 php-src/ext/dom/notation.c:1.12
--- php-src/ext/dom/notation.c:1.11     Fri Mar  3 20:13:12 2006
+++ php-src/ext/dom/notation.c  Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: notation.c,v 1.11 2006/03/03 20:13:12 rrichards Exp $ */
+/* $Id: notation.c,v 1.12 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -59,9 +59,9 @@
 
        ALLOC_ZVAL(*retval);
        if (nodep->ExternalID) {
-               ZVAL_STRING(*retval, (char *) (nodep->ExternalID), 1);
+               ZVAL_XML_STRING(*retval, (char *) (nodep->ExternalID), 
ZSTR_DUPLICATE);
        } else {
-               ZVAL_EMPTY_STRING(*retval);
+               ZVAL_EMPTY_TEXT(*retval);
        }
 
        return SUCCESS;
@@ -89,9 +89,9 @@
 
        ALLOC_ZVAL(*retval);
        if (nodep->SystemID) {
-               ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
+               ZVAL_XML_STRING(*retval, (char *) (nodep->SystemID), 
ZSTR_DUPLICATE);
        } else {
-               ZVAL_EMPTY_STRING(*retval);
+               ZVAL_EMPTY_TEXT(*retval);
        }
 
        return SUCCESS;
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/processinginstruction.c?r1=1.20&r2=1.21&diff_format=u
Index: php-src/ext/dom/processinginstruction.c
diff -u php-src/ext/dom/processinginstruction.c:1.20 
php-src/ext/dom/processinginstruction.c:1.21
--- php-src/ext/dom/processinginstruction.c:1.20        Mon Feb 13 10:23:57 2006
+++ php-src/ext/dom/processinginstruction.c     Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: processinginstruction.c,v 1.20 2006/02/13 10:23:57 dmitry Exp $ */
+/* $Id: processinginstruction.c,v 1.21 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -51,11 +51,10 @@
        int name_len, value_len, name_valid;
 
        php_set_error_handling(EH_THROW, dom_domexception_class_entry 
TSRMLS_CC);
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os|s", &id, dom_processinginstruction_class_entry, &name, &name_len, &value, 
&value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&|s&", &id, dom_processinginstruction_class_entry, &name, &name_len, 
UG(utf8_conv), &value, &value_len, UG(utf8_conv)) == FAILURE) {
                php_std_error_handling();
                return;
        }
-
        php_std_error_handling();
 
        name_valid = xmlValidateName((xmlChar *) name, 0);
@@ -99,7 +98,7 @@
        }
 
        ALLOC_ZVAL(*retval);
-       ZVAL_STRING(*retval, (char *) (nodep->name), 1);
+       ZVAL_XML_STRING(*retval, (char *) (nodep->name), ZSTR_DUPLICATE);
 
        return SUCCESS;
 }
@@ -129,10 +128,10 @@
 
        
        if ((content = xmlNodeGetContent(nodep)) != NULL) {
-               ZVAL_STRING(*retval, content, 1);
+               ZVAL_XML_STRING(*retval, content, ZSTR_DUPLICATE);
                xmlFree(content);
        } else {
-               ZVAL_EMPTY_STRING(*retval);
+               ZVAL_EMPTY_TEXT(*retval);
        }
 
        return SUCCESS;
@@ -156,7 +155,7 @@
                        zval_copy_ctor(&value_copy);
                        newval = &value_copy;
                }
-               convert_to_string(newval);
+               convert_to_string_with_converter(newval, UG(utf8_conv));
        }
 
        xmlNodeSetContentLen(nodep, Z_STRVAL_P(newval), Z_STRLEN_P(newval) + 1);
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/text.c?r1=1.26&r2=1.27&diff_format=u
Index: php-src/ext/dom/text.c
diff -u php-src/ext/dom/text.c:1.26 php-src/ext/dom/text.c:1.27
--- php-src/ext/dom/text.c:1.26 Mon Feb 13 10:23:57 2006
+++ php-src/ext/dom/text.c      Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: text.c,v 1.26 2006/02/13 10:23:57 dmitry Exp $ */
+/* $Id: text.c,v 1.27 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -55,12 +55,12 @@
        int value_len;
 
        php_set_error_handling(EH_THROW, dom_domexception_class_entry 
TSRMLS_CC);
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"O|s", &id, dom_text_class_entry, &value, &value_len) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"O|s&", &id, dom_text_class_entry, &value, &value_len, UG(utf8_conv)) == 
FAILURE) {
                php_std_error_handling();
                return;
        }
-
        php_std_error_handling();
+
        nodep = xmlNewText((xmlChar *) value);
 
        if (!nodep) {
@@ -98,7 +98,7 @@
 
        ALLOC_ZVAL(*retval);
        wholetext = xmlNodeListGetString(node->doc, node, 1);
-       ZVAL_STRING(*retval, wholetext, 1);
+       ZVAL_XML_STRING(*retval, wholetext, ZSTR_DUPLICATE);
 
        xmlFree(wholetext);
 
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/xpath.c?r1=1.29&r2=1.30&diff_format=u
Index: php-src/ext/dom/xpath.c
diff -u php-src/ext/dom/xpath.c:1.29 php-src/ext/dom/xpath.c:1.30
--- php-src/ext/dom/xpath.c:1.29        Mon Feb 13 10:23:57 2006
+++ php-src/ext/dom/xpath.c     Fri Aug  4 18:11:27 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: xpath.c,v 1.29 2006/02/13 10:23:57 dmitry Exp $ */
+/* $Id: xpath.c,v 1.30 2006/08/04 18:11:27 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -111,7 +111,7 @@
        dom_object *intern;
        unsigned char *prefix, *ns_uri;
 
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Oss", &id, dom_xpath_class_entry, &prefix, &prefix_len, &ns_uri, &ns_uri_len) 
== FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&s&", &id, dom_xpath_class_entry, &prefix, &prefix_len, UG(utf8_conv), 
&ns_uri, &ns_uri_len, UG(utf8_conv)) == FAILURE) {
                return;
        }
 
@@ -150,8 +150,7 @@
        xmlDoc *docp = NULL;
        xmlNsPtr *ns;
 
-
-       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os|O", &id, dom_xpath_class_entry, &expr, &expr_len, &context, 
dom_node_class_entry) == FAILURE) {
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os&|O", &id, dom_xpath_class_entry, &expr, &expr_len, UG(utf8_conv), &context, 
dom_node_class_entry) == FAILURE) {
                return;
        }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/tests/bug34276.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/dom/tests/bug34276.phpt
diff -u php-src/ext/dom/tests/bug34276.phpt:1.2 
php-src/ext/dom/tests/bug34276.phpt:1.3
--- php-src/ext/dom/tests/bug34276.phpt:1.2     Tue Jun 27 00:09:23 2006
+++ php-src/ext/dom/tests/bug34276.phpt Fri Aug  4 18:11:27 2006
@@ -41,3 +41,11 @@
 string(5) "attrc"
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <foo xmlns="http://www.example.com/ns/foo"; 
xmlns:fubar="http://www.example.com/ns/fubar"; 
xmlns:default="http://www.example.com/ns/foo"; attra="attra" 
default:attra="attranew" fubar:attrb="attrbnew" default:attrc="attrc"/>
+--UEXPECT--
+bool(false)
+unicode(0) ""
+unicode(8) "attranew"
+unicode(8) "attrbnew"
+unicode(5) "attrc"
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<foo xmlns="http://www.example.com/ns/foo"; 
xmlns:fubar="http://www.example.com/ns/fubar"; 
xmlns:default="http://www.example.com/ns/foo"; attra="attra" 
default:attra="attranew" fubar:attrb="attrbnew" default:attrc="attrc"/>

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to