[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:52:22 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):
{{{
Index: public_html/wp-includes/rest-api/class-wp-rest-server.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/public_html/wp-includes/rest-api/class-wp-rest-server.php
b/public_html/wp-includes/rest-api/class-wp-rest-server.php
--- a/public_html/wp-includes/rest-api/class-wp-rest-server.php (date
1607525283294)
+++ b/public_html/wp-includes/rest-api/class-wp-rest-server.php (date
1607525283294)
@@ -1399,7 +1399,7 @@
$endpoint_data['args'] = array();
foreach ( $callback['args'] as $key =>
$opts ) {
- $arg_data =
array_intersect_key( $opts, $allowed_schema_keywords );
+ $arg_data =
array_intersect_key( (array) $opts, $allowed_schema_keywords );
$arg_data['required'] = ! empty(
$opts['required'] );
$endpoint_data['args'][ $key ] =
$arg_data;
}}}
This patch solves the issue for me.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51986#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list