Support » Fixing WordPress » WordPress REST API warnings

  • Resolved DreamOn11

    (@dreamon11)


    Hello everybody,

    A simple get request to wp-json/wp/v2/posts give me these warnings:

    ( ! ) Warning: array_values() expects parameter 1 to be array, null given in /srv/www/lecrabeinfo.fr/current/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php on line 1925
    
    ( ! ) Warning: array_merge(): Argument #2 is not an array in /srv/www/xxx.fr/current/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php on line 1925
    
    ( ! ) Warning: array_values() expects parameter 1 to be array, null given in /srv/www/xxx.fr/current/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php on line 1925
    
    ( ! ) Warning: array_merge(): Argument #2 is not an array in /srv/www/xxx.fr/current/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php on line 1925
    
    ( ! ) Warning: array_values() expects parameter 1 to be array, null given in /srv/www/xxx.fr/current/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php on line 1925
    
    ( ! ) Warning: Cannot modify header information - headers already sent by (output started at /srv/www/xxx.fr/current/web/wp/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:1925) in /srv/www/xxx.fr/current/web/wp/wp-includes/rest-api/class-wp-rest-server.php on line 1244

    The result is well return but warnings before prevent software get request to retrieve it, because of warnings.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m unable to replicate your experience on another site, but using the same request. There may be a conflict amongst your plugins or theme. Have you tried:
    -deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).
    -switching to the default theme to rule out any theme-specific problems.

    Thanks for help @bcworkz.

    I create a ticket: https://core.trac.wordpress.org/ticket/39293#comment:5

    And problem fixed 😉

    @bcworkz: can you please edit my first post to remove my website domain please? 🙂

    Moderator bcworkz

    (@bcworkz)

    I’m glad you found the problematic code.

    I’m sorry but we will not be editing out your domain name. Per forum policy, forum topics will only be edited or deleted if they represent a valid legal, security, or safety concern.

    @bcworkz Hum… It is effectively valid security concern… Hackers – after they read this topic – know the access path of my website on the server.

    This is indeed a major security issue for my site.

    Thank you for your understanding.

    Moderator bcworkz

    (@bcworkz)

    Nice try but a domain published on the Internet is not considered a security concern. Security concerns revolve around passwords, personal financial and identity numbers, malicious code, etc. Any domain online can be found through domain registries, hackers don’t have to scrape data here to get that.

    This exact situation arises all the time and our policy in this regard has been well established. I’m sorry I’m unable to fulfill your request.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WordPress REST API warnings’ is closed to new replies.