php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8363 XML parser dies if character_data_handler set
Submitted: 2000-12-21 14:46 UTC Modified: 2000-12-23 16:48 UTC
From: bill at rsv dot ricoh dot com Assigned:
Status: Closed Package: XML related
PHP Version: 4.0.4 OS: RH Linux 6.2
Private report: No CVE-ID: None
 [2000-12-21 14:46 UTC] bill at rsv dot ricoh dot com
The following test case originally came from the online docs, but most recently from the xml2tree project I wrote (http://www.risource.org/phpTools/xml2tree/ );  two people have reported it broken with the release of 4.0.4.

----------- configuration -----------------
./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs

----------- test case ---------
 function characterData($parser, $data)
    {
      echo "in characterData got [$data]<br>";
    }

    $xml_parser = xml_parser_create();

    // commment out the following line to prevent the crash
    xml_set_character_data_handler($xml_parser, "characterData"); 

    $xmlContent = "<mytag> <othertag> goo </othertag><yuck>glumph</yuck></mytag>";

    echo "before data<br>"; flush();  


    // 4.0.4 dies here, but only if character_data_handler is set;
    // 4.0.3 is fine.
    if (!xml_parse($xml_parser, $xmlContent, "yes" )) { 
      die(sprintf("XML error: %s at line %d",
		  xml_error_string(xml_get_error_code($xml_parser)),
		  xml_get_current_line_number($xml_parser)));
    }
    echo "after  data<br>"; flush();
    xml_parser_free($xml_parser);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-23 16:48 UTC] thies@php.net
fixed in CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 04:01:28 2024 UTC