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_Parser » Bug #3066

$folding option not working

Details

Request #3066$folding option not working
Submitted2004-12-30 19:13 UTC
Fromj dot clifton at intuiworx dot com
StatusBogus
PackageXML_Parser
PHP Version4.3.9
OSMac OS X 10.3.7
Roadmaps(Not assigned)

Comments

[2004-12-30 19:13 UTC] j dot clifton at intuiworx dot com

Description:
------------
With the current class, it is not possible to set the
$folding option because folding is declared as true at
runtime, and then the constructor calls
xml_parser_set_option(); thus any changes made to
$folding are ignored.

If the call to xml_parser_set_option() is removed from
the constructor and parse() is modified as follows, the
problem is eliminated.

Reproduce code:
---------------
Original:

function parse()
{
if (!is_resource($this->fp)) {
return $this->raiseError("no input");
}

while ($data = fread($this->fp, 2048)) {

$err = $this->parseString($data, feof($this->fp));
if (PEAR::isError($err)) {
fclose($this->fp);
return $err;
}

}

fclose($this->fp);

return true;
}

Modified:

function parse()
{
if (!is_resource($this->fp)) {
return $this->raiseError("no input");
}

xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, $this->folding);

while ($data = fread($this->fp, 2048)) {

$err = $this->parseString($data, feof($this->fp));
if (PEAR::isError($err)) {
fclose($this->fp);
return $err;
}

}

fclose($this->fp);

return true;
}