RSS feed is broken
-
I am getting the following error with the RSS feed:
Fatal error: Uncaught TypeError: array_slice(): Argument #3 ($length) must be of type ?int, string given in /usr/local/pfSense/include/vendor/simplepie/simplepie/src/SimplePie.php:3165 Stack trace: #0 /usr/local/pfSense/include/vendor/simplepie/simplepie/src/SimplePie.php(3165): array_slice(Array, 0, '10') #1 /usr/local/pfSense/include/vendor/simplepie/simplepie/src/SimplePie.php(2997): SimplePie\SimplePie::merge_items(Array, 0, '10', 0) #2 /usr/local/www/widgets/widgets/rss.widget.php(109): SimplePie\SimplePie->get_items(0, '10') #3 /usr/local/www/index.php(430): include('/usr/local/www/...') #4 {main} thrown in /usr/local/pfSense/include/vendor/simplepie/simplepie/src/SimplePie.php on line 3165 PHP ERROR: Type: 1, File: /usr/local/pfSense/include/vendor/simplepie/simplepie/src/SimplePie.php, Line: 3165, Message: Uncaught TypeError: array_slice(): Argument #3 ($length) must be of type ?int, string given in /usr/local/pfSense/include/vendor/simplepie/simplepie/src/SimplePie.php:3165 Stack trace: #0 /usr/local/pfSense/include/vendor/simplepie/simplepie/src/SimplePie.php(3165): array_slice(Array, 0, '10') #1 /usr/local/pfSense/include/vendor/simplepie/simplepie/src/SimplePie.php(2997): SimplePie\SimplePie::merge_items(Array, 0, '10', 0) #2 /usr/local/www/widgets/widgets/rss.widget.php(109): SimplePie\SimplePie->get_items(0, '10') #3 /usr/local/www/index.php(430): include('/usr/local/www/...') #4 {main} thrown
Is there a way to remove it as the main page is unusable with the RSS feed causing it to crash.
This is on the latest 23.05 snapshot
-
You can edit the config file at the command line and remove the widget entry for it.
<widgets> <sequence>system_information:col1:open:0,disks:col1:open:0,netgate_services_and_support:col2:open:0,interfaces:col2:open:0,rss:col2:open:0</sequence> <period>10</period> </widgets>
So just remove
,rss:col2:open:0
The RSS widget works OK though. Did you add feeds to it?
-
I simply have the default RSS feed and its crashing.
I haven't modified it at all.
-
Hmm, in that case it's probably fixed already. I'm running a newer build that isn't public yet. Should be a in a few days.
Steve
-
Looks like a completely fresh install has a working RSS widget but if you open the RSS widget settings and click save without changing anything, then you can get that PHP error.
Inside the
<widgets>
section of the config.xml, look for a block like this and remove it:<rss-0> <descr><![CDATA[RSS]]></descr> <rssfeed>https://www.netgate.com/blog/</rssfeed> <rssmaxitems>10</rssmaxitems> <rsswidgetheight>300</rsswidgetheight> <rsswidgettextlength>140</rsswidgettextlength> </rss-0>
-
Probably too late to sneak that into 23.05 at this point but it's not a complex fix, should be easy to get into system patches after the release.
diff --git a/src/usr/local/www/widgets/widgets/rss.widget.php b/src/usr/local/www/widgets/widgets/rss.widget.php index 8da28c1203ffe54168cb919180b84df0b24af35c..c117d468ae8205c5e8d8622feab15b2a39225350 100644 --- a/src/usr/local/www/widgets/widgets/rss.widget.php +++ b/src/usr/local/www/widgets/widgets/rss.widget.php @@ -46,15 +46,15 @@ if ($user_settings['widgets'][$widgetkey]['rssfeed']) { } if ($user_settings['widgets'][$widgetkey]['rssmaxitems']) { - $max_items = $user_settings['widgets'][$widgetkey]['rssmaxitems']; + $max_items = (int) $user_settings['widgets'][$widgetkey]['rssmaxitems']; } if (is_numeric($user_settings['widgets'][$widgetkey]['rsswidgetheight'])) { - $rsswidgetheight = $user_settings['widgets'][$widgetkey]['rsswidgetheight']; + $rsswidgetheight = (int) $user_settings['widgets'][$widgetkey]['rsswidgetheight']; } if (is_numeric($user_settings['widgets'][$widgetkey]['rsswidgettextlength'])) { - $rsswidgettextlength = $user_settings['widgets'][$widgetkey]['rsswidgettextlength']; + $rsswidgettextlength = (int) $user_settings['widgets'][$widgetkey]['rsswidgettextlength']; } // Set a default feed if none exists
-
Ah, yes that hits the error. Widget shows but can't be removed.
-
@stephenw10 said in RSS feed is broken:
Ah, yes that hits the error. Widget shows but can't be removed.
It likely breaks JS for the whole page, so even navigating to another page from the menu can be a problem, though you can hit the link to the crash reporter page and from there get anywhere else (e.g. Backup/Restore to roll back in the config history).
-
I just upgraded to 23.05.r.20230513.1527 and hit this bug so rolled back to 23.01.
PHP Errors:
Uncaught TypeError: array_slice(): Argument #3 ($length) must be of type ?int, string given in /usr/local/pfSense/include/vendor/simplepie/simplepie/src/SimplePie.php:3165I assume the fix is not in this particular version yet.
-
@joedan said in RSS feed is broken:
must be of type ?int
If "20230513" (buid from last saterday ?) wasn't working, it would/should work with the 3 edited lines shown above by Jimp.