Re: [PHP4BETA] string and function argument php3->php4

From: Date: Mon, 20 Sep 1999 07:57:47 +0000
Subject: Re: [PHP4BETA] string and function argument php3->php4
References: 1 2  Groups: php.version4 
Request: Send a blank email to php-version4+get-4644@lists.php.net to get a copy of this message
(i've submitted a bug report for this too...) try this code with a valid default.xml with some xml code. it works fine with php3 and not with php4.... i get it to work with php4 too adding " to $tgname as in the commented line. i think it's a bug.... <? $level = 0; $tagname = array(); function XMLFstart($parser, $tgname, $attrs) { $GLOBALS['level']++; $GLOBALS['tagname'][$GLOBALS['level']] = $tgname; # $GLOBALS['tagname'][$GLOBALS['level']] = "$tgname"; print('&lt;'.$GLOBALS['tagname'][$GLOBALS['level']].'&gt;'); } function XMLFend($parser, $tgname) { $GLOBALS['level']--; print('&lt;/'.$GLOBALS['tagname'][$GLOBALS['level']].'&gt;'); } function XMLFparse($file) { $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "XMLFstart", "XMLFend"); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true); $fp = fopen($file, "r"); while ($data = fread($fp, filesize($file))) { if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf("<BR><BR>XML error: %s at line %d",xml_error_string(xml_get_error_code($xml_parser)),xml_get_current_line_n umber($xml_parser))); } } xml_parser_free($xml_parser); fclose($fp); } XMLFparse('./default.xml'); ?>

« previous php.version4 (#4644) next »