[wp-trac] [WordPress Trac] #52723: Admin options.php default value to NULL for option_value may lead to MySQL Integrity constraint violation error, potential other bugs

WordPress Trac noreply at wordpress.org
Tue Jun 4 09:36:57 UTC 2024


#52723: Admin options.php default value to NULL for option_value may lead to MySQL
Integrity constraint violation error, potential other bugs
-------------------------------------------------+-------------------------
 Reporter:  pinoceniccola                        |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.6
Component:  Options, Meta APIs                   |     Version:  2.7
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-unit-tests needs-    |     Focuses:
  testing                                        |  administration
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [ticket:52723 pinoceniccola]:
 > A simple solution would be to set a different default value (`0` or even
 an empty string) in `wp-admin/options.php` and, ''better yet'', **cast any
 `NULL` value to the same different default value in both `update_option`
 and `add_option`**.

 Hi there, welcome to WordPress Trac! Thanks for the ticket.

 As previously noted in comment:6:ticket:57728, it appears that changing
 this default might have unintended consequences, as some options, e.g.
 `blog_public`, actually rely on `null` being passed to `update_option()`
 if the option was not sent to `options.php`, see [21849] and [21851] /
 #16416.

 Related: [56132] / #57728.

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


More information about the wp-trac mailing list