Skip to content

Commit

Permalink
Add fixes to xml parser so there aren't any warnings
Browse files Browse the repository at this point in the history
Signed-off-by: viddler <kyle@viddler.com>
  • Loading branch information
kyleslattery authored and viddler committed Dec 21, 2008
1 parent f907c14 commit 815d715
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions xmlparser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# XML Library, by Keith Devens, version 1.2b
# http://keithdevens.com/software/phpxml
#
# Modified by Lee Adkins on April 11,2008
# Modifications: Removed explicit pass-by-reference in xml_parser creation
# to remove depreciation warnings. Functionality retained.
#
# This code is Open Source, released under terms similar to the Artistic License.
# Read the license at http://keithdevens.com/software/license
#
Expand Down Expand Up @@ -60,17 +64,19 @@ class XML{

function XML(){
$this->parser = &xml_parser_create();
xml_parser_set_option(&$this->parser, XML_OPTION_CASE_FOLDING, false);
xml_set_object(&$this->parser, &$this);
xml_set_element_handler(&$this->parser, 'open','close');
xml_set_character_data_handler(&$this->parser, 'data');
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'open','close');
xml_set_character_data_handler($this->parser, 'data');
}
function destruct(){ xml_parser_free(&$this->parser); }
function destruct(){ xml_parser_free($this->parser); }
function & parse(&$data){
$this->document = array();
$this->stack = array();
$this->parent = &$this->document;
return xml_parse(&$this->parser, &$data, true) ? $this->document : NULL;
// PHP 5 fix
$php5fix = xml_parse($this->parser, $data, true) ? $this->document : NULL;
return $php5fix;
}
function open(&$parser, $tag, $attributes){
$this->data = ''; #stores temporary cdata
Expand Down

0 comments on commit 815d715

Please sign in to comment.