Fixed RSS Feed Error PHP7.2RC2 and XF 1.5.15

MattW

Well-known member
Affected version
1.5.15
http://travaux.ovh.net/rss.php?proj=11

Using the above RSS feed, I'm now getting errors on PHP7.2RC2 using XF 1.5.15

Stack Trace
Code:
ErrorException: count(): Parameter must be an array or an object that implements Countable - library/Zend/Feed/Reader/Entry/Rss.php:204
Generated By: Matt, 1 minute ago
Stack Trace
#0 /home/nginx/domains/mattwservices.co.uk/public/library/Zend/Feed/Reader/Entry/Rss.php(204): XenForo_Application::handlePhpError(2, 'count(): Parame...', '/home/nginx/dom...', 204, Array)
#1 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/Model/Feed.php(215): Zend_Feed_Reader_Entry_Rss->getAuthors()
#2 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/Model/Feed.php(577): XenForo_Model_Feed->getFeedData('http://travaux....')
#3 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/ControllerAdmin/Feed.php(165): XenForo_Model_Feed->importFeedData(Array)
#4 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/FrontController.php(351): XenForo_ControllerAdmin_Feed->actionImport()
#5 /home/nginx/domains/mattwservices.co.uk/public/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#6 /home/nginx/domains/mattwservices.co.uk/public/admin.php(13): XenForo_FrontController->run()
#7 {main}

Code:
# php -v
PHP 7.2.0RC2 (cli) (built: Sep 26 2017 15:11:47) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0-dev, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.2.0RC2, Copyright (c) 1999-2017, by Zend Technologies
 
Hmm, that would seem to be a Zend Framework bug for both versions. Obviously very little hope of getting it fixed in XF 1.5 but might be more viable in 2.0.

I need to update my PHP 7.2 build so once I've had a chance to test this I'll report back.
 
We've fixed this for the next 1.5 release and confirmed that the same issue is not present in ZF2 (and therefore not in XF2).

It may be some time until the next 1.5 release (given that the current one took 3 months and even then was very small) so if you'd like to adjust this in the meantime then the fix is as follows.

Open the file library/Zend/Feed/Reader/Extension/Atom/Entry.php.

Find:
PHP:
$authors = null;

Replace with:
PHP:
$authors = array();
 
This is also pretty specific to the RSS feed -- notably, pretty sure it requires one that doesn't have any author data. But this will certainly effect quite a few less people than the Chrome regression (that causes issues that affect guests, registered users and moderators).
 
Top Bottom