Make WordPress Core

Opened 7 years ago

Closed 14 months ago

#38270 closed enhancement (wontfix)

Better handling of widget errors

Reported by: dustwolf's profile dustwolf Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Widgets Keywords:
Focuses: Cc:

Description

This change makes debugging broken widgets a lot less painful -- in case of errors in widgets this will allow the site to load and the developer to see the error messages instead of just blowing up with the ambiguous error message "Class not defined".

https://github.com/WordPress/WordPress/pull/207#issuecomment-252338814

Attachments (1)

134043eb91d1d6a560130a5d06237af5b1173c39.patch (1.1 KB) - added by dustwolf 7 years ago.
Patch

Download all attachments as: .zip

Change History (4)

#1 @westonruter
7 years ago

  • Keywords close added

Thanks for the suggestion. However, I don't think this is an improvement because if the class doesn't exist then there will be no error at all, no indication that there is a problem other than the widget not showing up. On the other hand, if attempting to create a new instance of a class that doesn't exist, then the developer will know right away that they forgot to add the necessary require_once statement.

#2 @dustwolf
7 years ago

With the original code, if there is an error, the page comes up blank and there is no indication what the problem may be.With my patch, the page loads, but the functionality of the offending widget is conspicuously missing. The solution is not perfect, but it doesn't take much to determine the lesser of two evils.

Furthermore with the existing code, if an end-user installs a widget with broken code, they get a blank page and cannot so much as uninstall the offending widget (without tweaking the database directly) because the interface is not accessible. If on the other hand they install a broken widget and it does not show up, they can understand that it doesn't work and remove it.

Version 0, edited 7 years ago by dustwolf (next)

#3 @desrosj
14 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Sorry that this one fell by the wayside, @dustwolf.

I agree with @westonruter that it's more preferable for an error to occur when a class is missing to clearly indicate that there is a problem. Because there have not been additional requests for this in the last 6 years, I'm going to close this out as a wontfix.

Since this ticket was created, the PHP Site Error protection feature shipped in WordPress 5.2, which prevents the site from showing a blank white screen and provides a means for site owners to access their site through by activating a recovery mode.

Note: See TracTickets for help on using tickets.