[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
Wed Dec 9 14:44:25 UTC 2020
#51986: PHP Warning: array_intersect_key(): Expected parameter 1 to be an array,
string given in class-wp-rest-server.php
-------------------------------+------------------------------
Reporter: slaFFik | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 5.6
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses: rest-api
-------------------------------+------------------------------
Comment (by apermo):
I have the same issue.
I've already posted some information here:
https://wordpress.org/support/topic/wordpress-5-6-upgrading-
issue/#post-13765662
I have the same issue, among my active plugins is redux, and quite a long
list of custom plugins.
Warning: array_intersect_key(): Expected parameter 1 to be an array,
string given in /wp-includes/rest-api/class-wp-rest-server.php on line
1402
Call Stack
# Time Memory Function Location
1 0.0109 488824 {main}( ) .../post.php:0
2 3.6107 69597144 require( '/wp-admin/edit-form-blocks.php'
) .../post.php:187
3 3.6108 69600920 array_reduce ( ) .../edit-form-
blocks.php:82
4 3.6108 69600920 rest_preload_api_request( ) .../edit-
form-blocks.php:82
5 3.6108 69601520 rest_do_request( ) .../rest-
api.php:2520
6 3.6820 71674264 WP_REST_Server->dispatch( ) .../rest-
api.php:479
7 3.6858 71732896 WP_REST_Server->respond_to_request( )
.../class-wp-rest-server.php:1007
8 3.6858 71732896 WP_REST_Server->get_index( ) .../class-
wp-rest-server.php:1160
9 3.6900 72029472 WP_REST_Server->get_data_for_routes( )
.../class-wp-rest-server.php:1243
10 3.6909 72042136 WP_REST_Server->get_data_for_route( )
.../class-wp-rest-server.php:1324
11 3.7373 72049584 array_intersect_key ( ) .../class-wp-rest-
server.php:1402
For testing I edited the code of class-wp-rest-server.php to:
foreach ( $callback['args'] as $key => $opts ) {
if ( ! is_array( $opts ) ) {
print_r(
$callback['args'] );
echo "\n";
print_r( $opts );
echo "\n\n";
}
$arg_data =
@array_intersect_key( $opts, $allowed_schema_keywords );
$arg_data['required'] = ! empty(
$opts['required'] );
$endpoint_data['args'][ $key ] =
$arg_data;
}
Giving me debug information which lead me to redux-framework/redux-
templates/classes.class-api.php and the class method register_api_hooks in
line 785 of that file where all of these are registered.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51986#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list