[PEAR-BUG] Bug #21168 [Com]: Cannot use string offset as an array in /usr/share/pear/XML/RSS.php:355

[email protected] ("[email protected]") Sat, 21 Jan 2017 14:10:48 -0500 (EST)
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at https://pear.php.net/bugs/bug.php?id=21168&edit=1

 ID:               21168
 Comment by:       [email protected]
 Reported By:      pasel at blueend dot com
 Summary:          Cannot use string offset as an array in
                    /usr/share/pear/XML/RSS.php:355
 Status:           Open
 Type:             Bug
 Package:          XML_RSS
 Operating System: Linux
 Package Version:  1.1.0a1
 PHP Version:      5.6.30
 Roadmap Versions: 
 New Comment:

I have added a pull request which is fixing the problem for me:

https://github.com/pear/XML_RSS/pull/5


Previous Comments:
------------------------------------------------------------------------

[2017-01-21 13:39:27] phroggar

Description:
------------
PHP Version is 7.1 (Bugtracker dropdown stops at 5.6). Bug preset in
stable and alpha.

I'm currently checking compatibility of our code wrt PHP 7.1 and i
noticed that some RSS feeds are not working anymore with XML_RSS.

Example Feeds not working anymore:

http://www.n-tv.de/23.rss
http://www.handelsblatt.com/contentexport/feed/schlagzeilen
http://www.spiegel.de/politik/index.rss

Stacktrace is different depending on the feeds (Stacktraces below)



Test script:
---------------
include_once "XML/RSS.php";
$rss = new XML_RSS('http://www.n-tv.de/23.rss');
$rss->parse();

Actual result:
--------------
<b>Fatal error</b>:  Uncaught Error: Cannot use string offset as an
array in /usr/share/pear/XML/RSS.php:282
Stack trace:
#0 [internal function]: XML_RSS->endHandler(Resource id #7,
'ENCLOSURE')
#1 /usr/share/pear/XML/Parser.php(526): xml_parse(Resource id #7, '<?xml
version="...', false)
#2 /usr/share/pear/XML/Parser.php(495): XML_Parser->_parseString('<?xml
version="...', false)
#3 /.../test.php(16): XML_Parser->parse()
#4 {main}
  thrown in <b>/usr/share/pear/XML/RSS.php</b> on line <b>282</b><br />


Fatal error</b>:  Uncaught Error: Cannot use string offset as an array
in /usr/share/pear/XML/RSS.php:355
Stack trace:
#0 /usr/share/pear/XML/RSS.php(313): XML_RSS->_add('item', 'category',
'Politik')
#1 [internal function]: XML_RSS->cdataHandler(Resource id #7,
'Politik')
#2 /usr/share/pear/XML/Parser.php(526): xml_parse(Resource id #7, '<?xml
version="...', false)
#3 /usr/share/pear/XML/Parser.php(495): XML_Parser->_parseString('<?xml
version="...', false)
#4 /.../test.php(16): XML_Parser->parse()
#5 {main}
  thrown in <b>/usr/share/pear/XML/RSS.php</b> on line <b>355</b><br />

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=21168&edit=1