PHP Simple XML Parser exploding on J2.5

388 views
Skip to first unread message

Christopher Reimer

unread,
Mar 14, 2012, 2:45:25 PM3/14/12
to joomla-de...@googlegroups.com
Greetings,

I have these two lines of PHP to read a "simple" XML file (fetched via cURL - http://api.plixi.com/api/tpapi.svc/users/5995705 ):

$xml = new SimpleXmlElement($data, LIBXML_NOCDATA);


return (string) $xml->LockerzId;

This works fine with J1.5 on MAMP running on my MacBook. However, an exception is thrown with J2.5 on the live server.

exception 'Exception' with message 'String could not be parsed as XML' in /home/creimer/public_html/software/modules/mod_showlockerz/helper.php:94 Stack trace: #0 /home/creimer/public_html/software/modules/mod_showlockerz/helper.php(94): SimpleXMLElement->__construct('') #1 /home/creimer/public_html/software/modules/mod_showlockerz/mod_showlockerz.php(57): showLockerz::getProfileID('http://api.plix...') #2 /home/creimer/public_html/software/plugins/system/jat3/jat3/core/joomla/modulehelper.php(188): require('/home/creimer/p...') #3 /home/creimer/public_html/software/libraries/joomla/document/html/renderer/module.php(106): JModuleHelper::renderModule(Object(stdClass), Array) #4 /home/creimer/public_html/software/libraries/joomla/document/html/renderer/modules.php(39): JDocumentRendererModule->render(Object(stdClass), Array, NULL) #5 /home/creimer/public_html/software/libraries/joomla/document/html/html.php(371): JDocumentRendererModules->render('user1', Array, NULL) #6 /home/creimer/public_html/software/plugins/system/jat3/jat3/core/template.php(1394): JDocumentHTML->getBuffer('modules', 'user1', Array) #7 /home/creimer/public_html/software/plugins/system/jat3/jat3/core/template.php(695): T3Template->getBuffer('modules', 'user1', Array) #8 /home/creimer/public_html/software/templates/ja_purity_ii/index.php(18): T3Template->render() #9 /home/creimer/public_html/software/libraries/joomla/document/html/html.php(531): require('/home/creimer/p...') #10 /home/creimer/public_html/software/libraries/joomla/document/html/html.php(591): JDocumentHTML->_loadTemplate('/home/creimer/p...', 'index.php') #11 /home/creimer/public_html/software/libraries/joomla/document/html/html.php(414): JDocumentHTML->_fetchTemplate(Array) #12 /home/creimer/public_html/software/includes/application.php(249): JDocumentHTML->parse(Array) #13 /home/creimer/public_html/software/index.php(48): JSite->render() #14 {main}

Would safe mode on the J2.5 live server be causing this problem?

I tried looking at Joomla XML parser but the documentation was lacking any practical examples for something similar to the two lines of PHP code.

Thank you,

Chris Reimer

Christopher Reimer

unread,
Mar 14, 2012, 3:42:19 PM3/14/12
to joomla-de...@googlegroups.com
I installed J1.5 on the live server. The module works fine with the same code. Not sure why it isn't working on J2.5.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

Christopher Reimer

unread,
Mar 14, 2012, 3:54:28 PM3/14/12
to joomla-de...@googlegroups.com
The J2.5 manifest file had an incorrect value (i.e., bad user ID number) than the one used in the J1.5 manifest file. Need to add a try/catch statement to my code to handle that situation better.

That concludes today's head banging session. :P
Reply all
Reply to author
Forward
0 new messages