[wp-trac] [WordPress Trac] #51986: PHP Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in class-wp-rest-server.php
WordPress Trac
noreply at wordpress.org
Fri Oct 7 10:32:27 UTC 2022
#51986: PHP Warning: array_intersect_key(): Expected parameter 1 to be an array,
string given in class-wp-rest-server.php
-------------------------------------------+----------------------------
Reporter: slaFFik | Owner: davidbaumwald
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 6.1
Component: Editor | Version: 5.6
Severity: normal | Resolution:
Keywords: php8 has-patch has-unit-tests | Focuses: rest-api
-------------------------------------------+----------------------------
Comment (by TobiasBg):
Updated suggestion after the change in the translatable string in [54346]:
{{{#!php
<?php
foreach( $arg_group['args'] as $arg ) {
if ( ! is_array( $arg ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: $args, 2: The REST API
route being registered. */
__( 'REST API %1$s should be an array of
arrays. Non-array value detected for %2$s.' ),
'<code>$args</code>',
'<code>' . $clean_namespace . '/' . trim(
$route, '/' ) . '</code>'
),
'6.1.0'
);
break; // Leave the foreach loop once one non-array
argument was found.
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51986#comment:44>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list