[wp-trac] [WordPress Trac] #60276: Fatal error with unexpected string value for sticky_posts option

WordPress Trac noreply at wordpress.org
Fri Jan 19 21:23:13 UTC 2024


#60276: Fatal error with unexpected string value for sticky_posts option
-------------------------------+-----------------------------
 Reporter:  mreishus           |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Future Release
Component:  General            |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+-----------------------------

Comment (by mreishus):

 Replying to [comment:2 jorbin]:
 > Thanks for the report @mreishus. I'm curious if the unexpected value is
 something that core can cause or if it only happens through direct changes
 to the DB or errant custom code. Can you share a bit about how you found
 this initially?
 >
 > It likely should be fixed but if it's not something core can cause on
 it's own, I think it lowers the priority.

 Sure, I found it while working on WordPress.com; a user had a site with
 the sticky_posts option set to an empty string. The type of site it is
 isn't allowed to run custom plugins or themes, so it must have been
 something in either core code or wp.com code.
 I couldn't find anything in either that would set the option to this.
 However, this particular site was created 15 years ago, so it has ran on a
 lot of versions of code.
 I can't say for certain it was done by core code, but it's a possibility.
 We've also found that the other parts of the code that read this option
 are defensive about unexpected return types. Here are some examples:

 https://github.com/WordPress/wordpress-
 develop/blob/5815624ead21b4e105f3ddb09a9657ad84da654f/src/wp-
 includes/post.php#L2698-L2700
 https://github.com/WordPress/wordpress-
 develop/blob/5815624ead21b4e105f3ddb09a9657ad84da654f/src/wp-
 admin/includes/post.php#L1288
 https://github.com/WordPress/wordpress-
 develop/blob/5815624ead21b4e105f3ddb09a9657ad84da654f/src/wp-includes
 /rest-api/endpoints/class-wp-rest-posts-controller.php#L304-L307

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60276#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list