Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#12854 closed defect (bug) (duplicate)

Link manager causes PHP warning

Reported by: wet's profile wet Owned by: nacin's profile nacin
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:

Description

Symptom:

Link manager throws a PHP warning.

Steps to reproduce:

  1. Install WP 3.0-beta
  1. Enter the dashboard
  1. Go to "Links"
  1. Receive one warning per link stating "Warning: array_map() [function.array-map]: Argument # 2 should be an array in /.../wp-includes/bookmark.php on line 316"

Possible cause:

sanitize_bookmark() wrongly assumes 'link_category' to be an array while actually it is read as a integer from $wpdb->links.

Possible root cause:

Apparently, get_bookmarks() does not populate the 'link_category' member from the taxonomy table like get_bookmark() does. This might be unintentional.

Change History (22)

#1 @nacin
15 years ago

  • Milestone changed from Unassigned to 3.0

#2 @ipstenu
15 years ago

This is still happening on the latest nightly.

#3 @nacin
15 years ago

  • Owner changed from filosofo to nacin
  • Status changed from new to assigned

#4 @wet
15 years ago

  • Cc r.wetzlmayr@… added

#5 @sivel
15 years ago

  • Cc matt@… added

I have not been able to duplicate this issue, at least not on HEAD nor on revisions 13500, 13600, 13700, 13800, 13900, 14000. Fresh install installs were used in all tests.

Install WP, log in, go to Links->Edit Links (Just clicking on the Links parent menu item takes you here).

I even added debugging directly before that array_map call and $value was always an array.

#6 @sivel
15 years ago

Oh, forgot to mention that I did indeed test with WP_DEBUG enabled.

#7 follow-up: @ipstenu
15 years ago

I just upgraded to last night's nightly and I'm still seeing this:

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/ipstenu/public_html/blog/wp-includes/bookmark.php  on line 316

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/ipstenu/public_html/blog/wp-includes/bookmark.php on line 316

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/ipstenu/public_html/blog/wp-includes/bookmark.php on line 316

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/ipstenu/public_html/blog/wp-includes/bookmark.php on line 316

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/ipstenu/public_html/blog/wp-includes/bookmark.php on line 316

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/ipstenu/public_html/blog/wp-includes/bookmark.php on line 316

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/ipstenu/public_html/blog/wp-includes/bookmark.php on line 316

Warning: array_map() [function.array-map]: Argument #2 should be an array in /home/ipstenu/public_html/blog/wp-includes/bookmark.php on line 316

Happens on both blogs I've got on WP 3.0

#8 in reply to: ↑ 7 @ipstenu
15 years ago

Since I can't edit .. Both blogs were upgrades from 2.9 which now that I re-read sivel's comment, I wonder if that's related.

One blog is Multi-site, one is single.

#9 @sivel
15 years ago

I'll attempt an upgrade soon from 2.9.2 and see what comes of that...

#10 @ipstenu
15 years ago

More info that's just going to make my head hurt.

Running WP Multi Site. UPGRADED blogs (ie ones that had been on Multi-site 3.0-alpha) have the link page error. I just created a new blog on that multi site and ... The link page work.

#11 @nacin
15 years ago

#12168, [13017]. What would need to happen is that sanitize_bookmark_field() would need to be called with link_category as the field, but not an array (of integers) as the value. I am wondering if what you're seeing is residual effects of what the bug fixed.

#12 @ipstenu
15 years ago

I applied the diff you posted and it still borks.

That sounds as good an explanation as any as to the problem. Let me know if there's anything I can test for you.

#13 @ipstenu
15 years ago

Okay, I think I've got it (or rather, I think I know where it's weird).

In my existing blogs, I have a field for 'link_category' in my database under wp_links

The new blog didn't have that! I dropped the field and the error went away!

Now, how to fix that other than to poke the DB? No idea, but that works. No errors in my error_log either

#14 @nacin
15 years ago

We dropped link_category in 2.8. dbDelta() should have removed it.

#15 @ipstenu
15 years ago

Interesting. Only two people have reported it. I wonder if it's specific to servers or if most people just don't look at their links page often enough to notice.

Both of my blogs went from 2.5 (I think?) to 2.8 to 2.9, hitting every update along the way. I have one still on 2.9 that started life on 2.9 and it DOES NOT have link_category.

#16 @wikichaves
15 years ago

  • Version set to 3.0

Hi,

I have the same error
http://u.wikichaves.com/3de9eb5bdddb11fc2f934d205eca6e66.png

  • Updated from 2.9.2
  • Bluehost server
  • Updated nightly build and still happens

wikichaves

#17 @wikichaves
15 years ago

  • Version 3.0 deleted

#18 @LesBessant
15 years ago

Had the same thing - a much-upgraded site still had the link_category field in wp_links. Dropping the field removed the issue.

As ipstenu suggests, I very rarely look at my links, and only went there today because I spotted that a plugin that I don't use any more had inserted a link for itself which I wanted to remove...

#19 @nacin
15 years ago

If this is a bug, then it's a bug in dbDelta. Let me run some upgrades.

#20 @nacin
15 years ago

Related, maybe duplicate: #13098. Still curious about link_category in upgrades.

#21 @coolmann
15 years ago

Yep, had the same problem, dropped the column in the database and the issue is now gone. I had upgraded from 2.9 to 3.0 alpha.

#22 @nacin
15 years ago

  • Milestone 3.0 deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

dbDelta doesn't drop fields. I'm closing this as a duplicate of #9435 (eventual dropping it from the schema) and #13098 (actual fix of error here).

Note: See TracTickets for help on using tickets.