Help - Search - Members - Calendar
Full Version: XML handlers crash PHP?
Invision Power Services > Community Forums > Community Web Design and Coding
_
I'm trying to write something which relies heavily on PHPs XML parsing functions. However, this particular function crashes PHP somehow. Not sure what causes it, so if anyone could explain, I'd appreciate it.

CODE
       // ! Action Method
       function init()
       {
               if(!$this->_running)
               {
                       die("Core NOTINITED.");
               }
               
               xml_set_element_handler($this->_XML, array(&$this, "_startElement"), array(&$this, "_endElement"));
               xml_set_character_data_handler($this->_XML, array(&$this, "_characterData"));
       }


-- Yes, $this->_XML IS created.
Rikki
Crashes it how? Does it give you an error or does it literally crash PHP itself?
_
Literally crashes the interpreter:
Click to view attachment

Translated:
PHP Script Interpreter has encountered an error and is canceled. We apologize for the inconvenience.

If you were in the middle of something - the usual stuff.

blink.gif

When I click on the link, I get this information:

CODE
szAppName : php.exe     szAppVer : 4.3.2.2     szModName : ntdll.dll    
szModVer : 5.1.2600.1217     offset : 00033aed    
Rikki
You have the XML extensions installed properly I assume?
FrostedPopTart
PHP version 4.3.11 came out on March 31st with a ton of bugfixes, however I am not sure if this is one of them or not... unsure.gif
_
QUOTE(Rikki @ Apr 2 2005, 09:46 AM)
You have the XML extensions installed properly I assume?
*

I should have, since function_exists('xml_parser_create') returns true. ermm.gif

I'm trying something else right now that I found elsewhere on the net:

CODE
               xml_set_object($this->_XML, &$this);
               xml_set_element_handler($this->_XML, "_startElement", "_endElement");
               xml_set_character_data_handler($this->_XML, "_characterData");
Michael_C
Have you checked the Event Viewer in Computer Management to see if anything is in there?
_
The method I said I'd try actually works. original.gif
So my final function is:

CODE
       // ! Action Method
       function connect()
       {
               if(!$this->_running)
               {
                       die("XQL core NOTINITED.");
               }
               
               xml_set_object($this->_XML, &$this);
               xml_set_element_handler($this->_XML, "_startElement", "_endElement");
               xml_set_character_data_handler($this->_XML, "_characterData");
       }


original.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.