rrichards                                Fri, 02 Apr 2010 20:08:15 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=297374

Log:
fix bug #48983 (DomDocument : saveHTMLFile wrong charset)

Bug: http://bugs.php.net/48983 (Open) DomDocument : saveHTMLFile wrong charset 
and crash
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/dom/document.c
    U   php/php-src/trunk/ext/dom/document.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-04-02 20:05:41 UTC (rev 297373)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-04-02 20:08:15 UTC (rev 297374)
@@ -55,6 +55,7 @@
 - Fixed bug #49192 (PHP crashes when GC invoked on COM object). (Stas)
 - Fixed bug #49059 (DateTime::diff() repeats previous sub() operation).
   (yoa...@gmail.com, Derick)
+- Fixed bug #48983 (DomDocument : saveHTMLFile wrong charset). (Rob)
 - Fixed bug #48902 (Timezone database fallback map is outdated). (Derick)
 - Fixed bug #46111 (Some timezone identifiers can not be parsed). (Derick)
 - Fixed bug #35673 (formatOutput does not work with saveHTML). (Rob)

Modified: php/php-src/branches/PHP_5_3/ext/dom/document.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/dom/document.c     2010-04-02 20:05:41 UTC 
(rev 297373)
+++ php/php-src/branches/PHP_5_3/ext/dom/document.c     2010-04-02 20:08:15 UTC 
(rev 297374)
@@ -2252,6 +2252,7 @@
        dom_object *intern;
        dom_doc_propsptr doc_props;
        char *file;
+       const char *encoding;

        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
                return;
@@ -2264,11 +2265,12 @@

        DOM_GET_OBJ(docp, id, xmlDocPtr, intern);

-       /* encoding handled by property on doc */

+       encoding = (const char *) htmlGetMetaEncoding(docp);
+
        doc_props = dom_get_doc_props(intern->document);
        format = doc_props->formatoutput;
-       bytes = htmlSaveFileFormat(file, docp, NULL, format);
+       bytes = htmlSaveFileFormat(file, docp, encoding, format);

        if (bytes == -1) {
                RETURN_FALSE;

Modified: php/php-src/trunk/ext/dom/document.c
===================================================================
--- php/php-src/trunk/ext/dom/document.c        2010-04-02 20:05:41 UTC (rev 
297373)
+++ php/php-src/trunk/ext/dom/document.c        2010-04-02 20:08:15 UTC (rev 
297374)
@@ -2252,6 +2252,7 @@
        dom_object *intern;
        dom_doc_propsptr doc_props;
        char *file;
+       const char *encoding;

        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
                return;
@@ -2264,11 +2265,12 @@

        DOM_GET_OBJ(docp, id, xmlDocPtr, intern);

-       /* encoding handled by property on doc */

+       encoding = (const char *) htmlGetMetaEncoding(docp);
+
        doc_props = dom_get_doc_props(intern->document);
        format = doc_props->formatoutput;
-       bytes = htmlSaveFileFormat(file, docp, NULL, format);
+       bytes = htmlSaveFileFormat(file, docp, encoding, format);

        if (bytes == -1) {
                RETURN_FALSE;

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

Reply via email to