Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#40654 closed defect (bug) (fixed)

Undefined offset: 1 in /wp-admin/includes/dashboard.php on line 1227

Reported by: flyerua's profile FlyerUA Owned by:
Milestone: 4.8 Priority: normal
Severity: major Version: 4.7.4
Component: Administration Keywords: has-patch
Focuses: administration Cc:

Description

This happens at the home page of the Dashboard, from within WordPress News widget, when it tries to get a random popular non-installed plugin. Can be easily recreated every time by deleting transient _transient_dash_88ae138922fe95674369b1cb3d215a2b from within the options table.

Attachments (4)

Undefined offset_1.rtf (4.5 KB) - added by psysolix 8 years ago.
Error Log
40654.patch (518 bytes) - added by chesio 8 years ago.
Patch for #40654
40654.2.patch (518 bytes) - added by FlyerUA 8 years ago.
Patch for #40654. Removes seemingly pointless list
40654_1.patch (487 bytes) - added by FlyerUA 8 years ago.
Patch for #40654. Removes seemingly pointless list

Download all attachments as: .zip

Change History (15)

#1 @psysolix
8 years ago

  • Severity changed from normal to major

Hi FlyerUA,

I am having this issue as well, I suspected it was because of a configuration change by Vagrant. (VVV) Are you using Varying Vagrant for local development?

I also have this bug when installing/updating/ usage of duplicator plugin (when making package)

I'm changing it to Major Prio, because multiple people are affected.
https://wordpress.org/support/topic/undefined-index-and-undefined-offset/

Have you encountered a temp fix for it?

Thanks!

Version 0, edited 8 years ago by psysolix (next)

@psysolix
8 years ago

Error Log

#2 in reply to: ↑ description @FlyerUA
8 years ago

Hi, psysolix.
I've tried on one site hosted on WP Engine (I'm not sure if Vagrant is used there) and on 2 sites (1 development and one was completely clean install for the sake of testing this bug) on my own VPS (Vagrant is not used for sure), so I'm pretty sure Vagrant has nothing to do with this bug.
I haven't tried plugin you've mentioned to see if it happens to me too.
And no, I haven't encountered any temp fix yet.
Also, I can't change priority. It's grayed out for me.

#3 follow-up: @Presskopp
8 years ago

FYI: 'list' logic has changed with PHP7, and 'array_pad' could be helping here.

#4 in reply to: ↑ 3 @FlyerUA
8 years ago

Oh, good thing you've mentioned it.
While my VPS does have 7.1.4, site hosted on WP engine has 5.6.30

#5 @wfasa
8 years ago

Confirmed bug is PHP version independent also seeing this on Multisite with PHP 5.5.38

#6 @wfasa
8 years ago

It looks to me like this happens because that row tries to explode a string by # but no # exists in the string. Here is line 1227

list($link, $frag) = explode( '#', $item->get_link() );

and here is a var_dump of $item->get_link()

string(42) "https://wordpress.org/plugins/woocommerce/"

That $frag doesn't look like it's being used anywhere, but it would have been populated with that "offset 1" mentioned in the error message if the string actually had a #.

Last edited 8 years ago by wfasa (previous) (diff)

#7 @chesio
8 years ago

I'm getting these notices on several sites too, they started to pop up 2-3 weeks ago already.

Since $frag variable is unused as @wfasa noticed, a simple way to stop getting the notices is to omit $frag from list construct:

list($link, ) = explode( '#', $item->get_link() );

@chesio
8 years ago

Patch for #40654

#8 @chesio
8 years ago

  • Keywords has-patch added

@FlyerUA
8 years ago

Patch for #40654. Removes seemingly pointless list

@FlyerUA
8 years ago

Patch for #40654. Removes seemingly pointless list

#9 @iandunn
8 years ago

Related #40702, which deprecates wp_dashboard_plugins_output().

#10 @chesio
8 years ago

  • Resolution set to invalid
  • Status changed from new to closed

The entire wp_dashboard_plugins_output() function has been removed in [40607], so this issue will be gone with 4.8.

#11 @SergeyBiryukov
8 years ago

  • Milestone changed from Awaiting Review to 4.8
  • Resolution changed from invalid to fixed
Note: See TracTickets for help on using tickets.