Bug #4258: xml_parse fails with 'out of memory'
| From: | mookid at sigent dot ru | Date: | Thu, 27 Apr 2000 13:02:07 +0000 |
| Subject: | Bug #4258: xml_parse fails with 'out of memory' | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18204@lists.php.net to get a copy of this message | ||
From: mookid@sigent.ru
Operating system: Linux-Mandrake 7.0
PHP version: 3.0.16
PHP Bug Type: Misbehaving function
Bug description: xml_parse fails with 'out of memory'
My XML parsing exercises have stuck with xml_parse() returning an 'out of memory' error.
Here's a text script:
<?php
header('Content-Type: text/html');
function StartTag($parser, $tag, $attrs)
{
echo "<$tag";
while (list ($attr, $value) = each($attrs)) {
echo " $attr";
if (!empty($value)) {
echo "=\"$value\"";
}
}
echo ">";
}
$parser = xml_parser_create();
if (!$parser) {
die('xml_parser_create failed: ' . xml_error_string($parser));
}
if (!xml_set_element_handler($parser, 'StartTag', FALSE)) {
die('xml_set_element_handler failed: ' . xml_error_string($parser));
}
$data = '<tag attr1 attr2="this is a test " "/>';
// $data = '';
if (!xml_parse($parser, $data, TRUE)) {
die('xml_parse failed: ' . xml_error_string($parser));
}
?>
I'm using Apache 1.3.12 with the Russian patch.
Both Apache and PHP were compiled with Expat in mind, so that xml_* functions exist. This occurs on
two Linux installations, one being Mandrake 7.0, other is the recent Slackware. Peeking at the
source, I found that it's rather
Apache/Expat misbehaviour, and PHP source comments say something of that kind.
Any chance that it can be fixed?