WordPress.org

Make WordPress Core

Opened 23 months ago

Last modified 23 months ago

#42875 new defect (bug)

/var/www/html/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php on line 328

Reported by: perrywagle Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.1
Component: REST API Keywords:
Focuses: Cc:
PR Number:

Description

Getting the error:

Undefined index: items in /var/www/html/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php on line 328

The context of that line is that the variable is determined to be an 'array', but then gets indexed by the string 'items', which is not in the apparently associative array of associative array (?).

Apparently, some people trigger this, and some don't.

Change History (3)

#1 @perrywagle
23 months ago

Actually, with debugging on, it doesn't work.

#2 @perrywagle
23 months ago

AH. Its leaving out the

define( 'WP_DEBUG_DISPLAY', false );

that does it (default true).

Seems seems to be a problem, just a different one.

Last edited 23 months ago by perrywagle (previous) (diff)

#3 @dshanske
23 months ago

I traced the issue, in discussions with @perrywagle to a plugin using register_setting to declare a type of 'array' and noting show_in_rest.

It says that valid types are 'string', 'boolean', 'integer', and 'number'. I don't recall seeing this when the feature was first extended. Either way, the addition of a function in 4.9 created this error if the type is not set to one of the above 4.

The simple solution is, if it is an unsupported type, it should generate an error about that.

Note: See TracTickets for help on using tickets.