[wp-trac] [WordPress Trac] #57674: unregister_setting() raises a PHP warning on unknown settings

WordPress Trac noreply at wordpress.org
Tue Oct 10 12:37:31 UTC 2023


#57674: unregister_setting() raises a PHP warning on unknown settings
-------------------------------------------------+-------------------------
 Reporter:  xknown                               |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.4
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  php81 has-patch has-unit-tests       |     Focuses:  php-
  commit                                         |  compatibility
-------------------------------------------------+-------------------------

Comment (by hellofromTonya):

 The patch fixes 2 different PHP Warning|Notice scenarios:

 1. When the global `$new_allowed_options` is `null`, fixes raising `Trying
 to access array offset on value of type null` PHP Notice (PHP 7.4) |
 Warning (on PHP 8).

 2. When the global `$new_allowed_options` is an `array` and the setting
 group key does not exist, fixes raising "Undefined index:
 unknown_setting_group" PHP Notice (PHP 7) | Warning (on PHP 8).

 See both scenarios in action https://3v4l.org/oeFUJ.

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


More information about the wp-trac mailing list