PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » XML » XML_Beautifier » Bug #1148

Fails under PHP5 RC1

Details

Submitted2004-04-06 18:35 UTC
Fromahundiak at ingr dot com
StatusBogus
PackageXML_Beautifier
PHP Version5CVS-2004-04-06 (dev)
OSLinux
Roadmaps(Not assigned)

Comments

[2004-04-06 18:35 UTC] ahundiak at ingr dot com

Description:
------------
Under PHP 5.0.0RC1 (cli),
$xml = '<?xml version="1.0"?>' . "\n" . '<tables><table></table></tables>';
$fmt = new XML_Beautifier();
echo $fmt->formatString($xml);
Fails with:
Fatal error: Object does not support method calls in /home/ahundiak/include/pear/XML/Parser.php on line 303
It works under PHP 4.3.4 (cli)

XML_Beautifier_Tokenizer does not have a constructor. Instead, it calls XML_Parser from the tokenize method. PHP5 does not like it when you call a constructor as a regular method. There was some discussion on this on the internals mailing list. So create a XML_Beautifier_Tokenizer constructor and call XML_Parser from there. Then use:
$tokenizer =& new XML_Beautifier_Tokenizer();
to avoid problems with $this and xml_set_object.

The class will now work under PHP5 except that the <?xml string get's lost. As far as I can tell, xml_set_default_handler does not work in PHP5. Still researching it.