dmitry          Wed Jul 11 16:47:30 2007 UTC

  Modified files:              
    /php-src/ext/xmlreader      php_xmlreader.c 
    /php-src/ext/xmlreader/tests        008.phpt 
  Log:
  Unicode support
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xmlreader/php_xmlreader.c?r1=1.45&r2=1.46&diff_format=u
Index: php-src/ext/xmlreader/php_xmlreader.c
diff -u php-src/ext/xmlreader/php_xmlreader.c:1.45 
php-src/ext/xmlreader/php_xmlreader.c:1.46
--- php-src/ext/xmlreader/php_xmlreader.c:1.45  Fri Jan 12 12:16:36 2007
+++ php-src/ext/xmlreader/php_xmlreader.c       Wed Jul 11 16:47:30 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_xmlreader.c,v 1.45 2007/01/12 12:16:36 tony2001 Exp $ */
+/* $Id: php_xmlreader.c,v 1.46 2007/07/11 16:47:30 dmitry Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1094,16 +1094,22 @@
        int source_len = 0, encoding_len = 0;
        long options = 0;
        xmlreader_object *intern = NULL;
-       char *source, *uri = NULL, *encoding = NULL;
+       zstr source;
+       char *uri = NULL, *encoding = NULL;
        int resolved_path_len;
        char *directory=NULL, resolved_path[MAXPATHLEN];
        xmlParserInputBufferPtr inputbfr;
        xmlTextReaderPtr reader = NULL;
+       zend_uchar source_type;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|s!l", &source, 
&source_len, &encoding, &encoding_len, &options) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t|s!l", &source, 
&source_len, &source_type, &encoding, &encoding_len, &options) == FAILURE) {
                return;
        }
 
+       if (source_type == IS_UNICODE) {
+               source.s = php_libxml_unicode_to_string(source.u, source_len, 
&source_len TSRMLS_CC);
+       }
+
        id = getThis();
        if (id != NULL && ! instanceof_function(Z_OBJCE_P(id), 
xmlreader_class_entry TSRMLS_CC)) {
                id = NULL;
@@ -1118,7 +1124,11 @@
                RETURN_FALSE;
        }
 
-       inputbfr = xmlParserInputBufferCreateMem(source, source_len, 
XML_CHAR_ENCODING_NONE);
+       inputbfr = xmlParserInputBufferCreateMem(source.s, source_len, 
XML_CHAR_ENCODING_NONE);
+
+       if (source_type == IS_UNICODE) {
+               efree(source.s);
+       }
 
     if (inputbfr != NULL) {
 /* Get the URI of the current script so that we can set the base directory in 
libxml */
http://cvs.php.net/viewvc.cgi/php-src/ext/xmlreader/tests/008.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/xmlreader/tests/008.phpt
diff -u php-src/ext/xmlreader/tests/008.phpt:1.3 
php-src/ext/xmlreader/tests/008.phpt:1.4
--- php-src/ext/xmlreader/tests/008.phpt:1.3    Sat Aug  5 12:32:54 2006
+++ php-src/ext/xmlreader/tests/008.phpt        Wed Jul 11 16:47:30 2007
@@ -4,7 +4,7 @@
 <?php if (!extension_loaded("xmlreader")) print "skip"; ?>
 --FILE--
 <?php 
-/* $Id: 008.phpt,v 1.3 2006/08/05 12:32:54 rrichards Exp $ */
+/* $Id: 008.phpt,v 1.4 2007/07/11 16:47:30 dmitry Exp $ */
 
 $xmlstring = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE LIST SYSTEM "dtdexample.dtd">
@@ -22,7 +22,7 @@
 </MOVIE>
 </LIST>';
 
-$dtdfile = rawurlencode(dirname(__FILE__)) . b'/dtdexample.dtd'; 
+$dtdfile = rawurlencode((binary)dirname(__FILE__)) . b'/dtdexample.dtd'; 
 $file = dirname(__FILE__) . '/__008.xml';
 file_put_contents($file, $xmlstring);
 

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

Reply via email to