PHP 4.0 Bug #7893 Updated: Parser cannot return from method in object called by xml_parse
| From: | marek dot berkan at e-point dot pl | Date: | Wed, 22 Nov 2000 10:40:43 +0000 |
| Subject: | PHP 4.0 Bug #7893 Updated: Parser cannot return from method in object called by xml_parse | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38881@lists.php.net to get a copy of this message | ||
ID: 7893
User Update by: marek.berkan@e-point.pl
Old-Status: Open
Status: Closed
Bug Type: *XML functions
Description: Parser cannot return from method in object called by xml_parse
This bug is resolved in PHP v. 4.0.3. Sorry.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-20 12:21:57] marek.berkan@e-point.pl
I have an object that implement XML parser. One of its' method is called when parser found
start tag. If I use in this method functions who operating on associative array (i.e. each, next or
current) that PHP engine run to end of this method and stopping. If I don't use flush()
function in script then no content is sending to client. So if I use flush function then content
generated before is sending.
There is some example:
class XMLParser {
var $parser;
var $depth;
function XMLParser () {
$depth = array();
$this->parser = xml_parser_create();
xml_set_object($this->parser,$this);
xml_set_element_handler($this->parser,"open_tag","close_tag");
xml_set_character_data_handler($this->parser,"cdata");
}
function open_tag($parser, $tag, $attrs) {
echo "Before";
flush();
$atrybuty = array();
$atrybuty["klucz1"] = "wartosc1";
$atrybuty["klucz2"] = "wartosc2";
reset($atrybuty);
while (list($klucz, $wartosc) = each ($atrybuty)) {
echo $klucz." => ".$wartosc.", ";
}
echo "After";
flush();
}
function close_tag($parser, $tag) {
...
}
function cdata($parser, $cdata) {
...
}
function parseFile($data) {
xml_parse($this->parser,$data);
}
} // end of XMLParser object
$test = new XMLParser(); // create object
$test->parseFile('<A ID="hallo">PHP</A>'); // start parser
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7893