XML_UNserializer: Fatal error: Cannot use string offset as an array

From: Date: Fri, 03 Oct 2008 20:36:39 +0000
Subject: XML_UNserializer: Fatal error: Cannot use string offset as an array
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-29316@lists.php.net to get a copy of this message
I'm using XML_Unserializer to parse the following XML: <movie_info> <movie_title>bebeth video</movie_title> <author_name>bebeth</author_name> <storyline>A Friendship Fiasco</storyline> <video_info> <clip_info> <path>images/media/Outside3.flv</path> <start>1</start> <length>40</length> <type>video</type> <title>Outside</title> <caption>null</caption> <flip>0</flip> </clip_info> </video_info> <audio_info> </audio_info> </movie_info> Let's say I'm unserializing the XML into a variable called $results. I get an array and can do a print_r( $results ), and I get a print out of the array. But when I access the array at video_info or deeper (e.g. print_r( $results['movie_info']['video_info'] ) ) I get the error: Fatal error: Cannot use string offset as an array in But I can print_r($results['movie_info']['video_info']['clip_info'] ), and I get a print out of the array, I just get the fatal error . Any thoughts? Below is the actual code I'm doing: $options = array( XML_UNSERIALIZER_OPTION_ATTRIBUTES_PARSE => false, XML_UNSERIALIZER_OPTION_ATTRIBUTES_ARRAYKEY => true ); $Unserializer = &new XML_Unserializer($options); $status = $Unserializer->unserialize( '<xml>' .$xml . '</xml>' ); if (PEAR::isError($status)) { die( $sUrl . '<br />' . $status->getMessage()); } $results = $Unserializer->getUnserializedData(); Thanks, Mark

« previous php.pear.general (#29316) next »