php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4258 xml_parse fails with 'out of memory'
Submitted: 2000-04-27 09:02 UTC Modified: 2000-04-27 22:36 UTC
From: mookid at sigent dot ru Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.16 OS: Linux-Mandrake 7.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mookid at sigent dot ru
New email:
PHP Version: OS:

 

 [2000-04-27 09:02 UTC] mookid at sigent dot ru
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 &quot;&nbsp;"/>';
// $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?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-04-27 22:36 UTC] mookid at sigent dot ru
oops, I forgot to call xml_get_error_code(),
stupid me.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 12 19:01:30 2024 UTC