Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#4809 closed defect (bug) (fixed)

Returning WP_Error objects in unexpected places

Reported by: filosofo Owned by: filosofo
Milestone: 2.5 Priority: high
Severity: major Version: 2.3
Component: General Keywords: wp_error
Focuses: Cc:


All of the functions listed below return WP_Error objects if something goes wrong. The problem is that in most of the many places where these functions appear throughout the WordPress codebase, whatever has called them is not expecting to get a WP_Error object.

So what happens is that you get a fatal error along the lines of "Fatal error: Cannot use object of type WP_Error as array in . . ." instead of the kind of helpful error handling WP_Error is supposed to provide.

I would like to use this ticket to create patches to address each of the areas where this occurs.

Functions that return WP_Error objects
(those marked with * have received the WP_Error object from elsewhere)


Attachments (1)

errors.diff (23.2 KB) - added by filosofo 14 years ago.

Download all attachments as: .zip

Change History (12)

#1 @filosofo
14 years ago

  • Owner changed from anonymous to filosofo

#2 @ryan
14 years ago

  • Priority changed from normal to high

#3 @filosofo
14 years ago

I've been working on this, but it's very involved--a wp error potentially gets returned in dozens of places. Would it be better to post one big patch or piecemeal as I'm doing it?

#4 @ryan
14 years ago

Piecemeal. For 2.3 we can probably only do the nastier ones.

#5 @santosj
14 years ago

Is it okay if someone submits a patch?

14 years ago

#6 @filosofo
14 years ago

I've attached what I've done so far.

#7 @ryan
14 years ago

(In [6125]) Add checks for WP_Error. Props filosofo. see #4809

#8 @ryan
14 years ago

general-template and widgets didn't apply cleanly.

#9 @ryan
14 years ago

(In [6148]) Add checks for WP_Error. Props filosofo. see #4809

#10 @ryan
14 years ago

  • Milestone changed from 2.3 to 2.4

I think we're good enough for 2.3. Moving to 2.4 to finish any remaining places.

#11 @ryan
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.