Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#41008 new defect (bug)

WP_Error wrote instead of category name in wp_options table, category_base field

Reported by: Neilgaiman Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8
Component: General Keywords:
Focuses: Cc:


I just installed Wordpress 4.8, yet I'm not sure it's a bug specific of this version or not.

The issue is documented in the following post:


Long story short, it seems that sometimes (when some errors occurs, in my scenario was a I/O error) the category_base value of the wp_options table gets filled with a WP_Error json object instead of a category name. This raises an exception in the rewrite.php script (line 326) when the function tries to use that value against a regex, expecting a string.

Sadly enough, it doesn't seem easy to reproduce.

Change History (1)

#1 @Neilgaiman
3 years ago

As explained in my post, the easiest workaround seems to set the category_base value empty (empty string): that way the category_base original value is lost but at least the website doesn't crash.

Other viable fixes could include the following:

  • trap the rewrite.php method (using try/catch) so that it won't crash the web application (weak)
  • throw/log/output the WP_Error to the user instead of silently writing it into the category_base value (probably the best approach)
Note: See TracTickets for help on using tickets.