[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 10:17:07 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 xmic):

 Thanks @SergeyBiryukov

 We may want to remove the reliance on the `null` check for the option/s,
 and instead use `empty()` to check if the value is either `null` or an
 empty string `''`.

 That way, it becomes clearer to check for an empty value ''without
 reliance on a specific type''.

 Any thoughts?

 {{{#!php
 <?php

 $a = empty(null);
 echo var_export($a); // true

 $a = empty('');
 echo var_export($a); // true
 }}}

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


More information about the wp-trac mailing list