Make WordPress Core

Opened 20 years ago

Closed 20 years ago

#801 closed defect (bug) (fixed)

Warning: array_slice(): The first argument should be an array

Reported by: carnaticwm's profile carnaticwm Owned by: matt's profile matt
Milestone: Priority: normal
Severity: minor Version: 1.5
Component: General Keywords:
Focuses: Cc:

Description

Greetings,

I upgraded to 1.5-gamma 2005-02-04

I am not sure if this issue is occuring only because of the upgrade...

In the dashboard, am getting message

...

Other WordPress News more »

Warning: array_slice(): The first argument should be an array in /home/carnatic/public_html/kishore/blog/wp-admin/index.php on line 134

Warning: Invalid argument supplied for foreach() in /home/carnatic/public_html/kishore/blog/wp-admin/index.php on line 136

...

It seems that error is occuring because of the following code

...
$rss = @fetch_rss('http://planet.wordpress.org/feed/');
var_dump($rss);
if ( $rss ) {
...

Attachments (1)

WP-Issue-0000801.png (16.6 KB) - added by carnaticwm 19 years ago.

Download all attachments as: .zip

Change History (9)

#1 @carnaticwm
20 years ago

  • Patch set to No

#2 @anonymousbugger
20 years ago

FWIW, I have a fresh install of 1.5-gamma 2005-02-04 and I am not seeing the same thing.

#3 @carnaticwm
20 years ago

Am using 1.5-gamma 2005-02-04 as well

Added the following code after @fetch_rss

echo is_array($rss->items) ? 'Array' : 'not an Array';

Results
1) http://wordpress.org/development/feed/ >>> Array
2) http://planet.wordpress.org/feed/ >>> not an Array

Therefore, maybe instead of using

if ( $rss ) {

if ( is_array($rss->items) ) {

should be used

and an else added to state

feed doesnot seem to be valid !

edited on: 02-04-05 23:47

edited on: 02-04-05 23:47

edited on: 02-04-05 23:50

#4 @carnaticwm
20 years ago

The code seems to display valid html for the first time of the day !

The html displayed is http://mosquito.wordpress.org/file_download.php?file_id=266&type=bug - From the second time the $rss->items doesnot seem to be a valid array !

#5 @sparkyewu
20 years ago

I do not have a fresh install and am getting the same thing, have been using the nightlies for a couple months now.

#6 @sparkyewu
20 years ago

Seems to be working today.. could it be the feeds themselves?

Wait no, its working sometimes and other times its not..

edited on: 02-09-05 21:26

#7 @Lionfire
20 years ago

I'm not sure why it isn't working, but changing:

if ( $rss ) {

to:

if ( isset($rss->items) && 0 != count($rss->items) ) {

as with the first call to fetch_rss() stops things breaking further. I'm fairly sure this is a better way to error check here, so the change should be made anyway.

#8 @matt
20 years ago

  • fixed_in_version set to 1.5
  • Owner changed from anonymous to matt
  • Resolution changed from 10 to 20
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.