[wp-trac] [WordPress Trac] #62682: Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given

WordPress Trac noreply at wordpress.org
Thu Dec 12 07:53:03 UTC 2024


#62682: Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must
be of type array, string given
--------------------------+-----------------------------
 Reporter:  akeda         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  trunk
 Severity:  minor         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 To trigger this error:

 {{{
 curl 'http://localhost:8889//wp-json/wp/v2/pages/?format=text'
 }}}

 Stack trace:

 {{{
 #0 /var/www/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-
 controller.php(363): in_array('standard', 'text', true)
 #1 /var/www/src/wp-includes/rest-api/class-wp-rest-server.php(1292):
 WP_REST_Posts_Controller->get_items(Object(WP_REST_Request))
 #2 /var/www/src/wp-includes/rest-api/class-wp-rest-server.php(1125):
 WP_REST_Server->respond_to_request(Object(WP_REST_Request),
 '/wp/v2/pages', Array, NULL)
 #3 /var/www/src/wp-includes/rest-api/class-wp-rest-server.php(439):
 WP_REST_Server->dispatch(Object(WP_REST_Request))
 #4 /var/www/src/wp-includes/rest-api.php(449):
 WP_REST_Server->serve_request('/wp/v2/pages')
 #5 /var/www/src/wp-includes/class-wp-hook.php(324):
 rest_api_loaded(Object(WP))
 #6 /var/www/src/wp-includes/class-wp-hook.php(348):
 WP_Hook->apply_filters('', Array)
 #7 /var/www/src/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
 #8 /var/www/src/wp-includes/class-wp.php(418):
 do_action_ref_array('parse_request', Array)
 #9 /var/www/src/wp-includes/class-wp.php(813): WP->parse_request('')
 #10 /var/www/src/wp-includes/functions.php(1337): WP->main('')
 #11 /var/www/src/wp-blog-header.php(16): wp()
 #12 /var/www/src/_index.php(17): require('/var/www/src/wp...')
 #13 /var/www/src/index.php(19): require_once('/var/www/src/_i...')
 #14 {main}
   thrown in <b>/var/www/src/wp-includes/rest-api/endpoints/class-wp-rest-
 posts-controller.php</b> on line <b>363</b><br />
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62682>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list