[wp-trac] [WordPress Trac] #42875: Registering an "array" setting for the REST API causes a "Undefined index: items" warning (was: /var/www/html/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php on line 328)

WordPress Trac noreply at wordpress.org
Wed Nov 6 02:24:42 UTC 2019


#42875: Registering an "array" setting for the REST API causes a "Undefined index:
items" warning
--------------------------------------+--------------------------------
 Reporter:  perrywagle                |       Owner:  TimothyBlynJacobs
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  5.4
Component:  REST API                  |     Version:  4.9
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  docs
--------------------------------------+--------------------------------
Changes (by TimothyBlynJacobs):

 * status:  new => assigned
 * focuses:   => docs
 * owner:  (none) => TimothyBlynJacobs
 * version:  4.9.1 => 4.9
 * milestone:  Awaiting Review => 5.4
 * keywords:   => has-patch has-unit-tests


Comment:

 See also https://core.trac.wordpress.org/ticket/43392#comment:45 which had
 the same issue.

 To summarize, when registering an array setting, a defined "items" schema
 is required. I've uploaded a patch that mirrors the fix in #43392, except
 that it won't prevent the registration of the setting. Since this code is
 already in the wild, I don't think we can prevent the registration. This
 means you'll still get the PHP warning as well.

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


More information about the wp-trac mailing list