Support » Fixing WordPress » class-wp-xmlrpc-server.php – array_unshift() expects parameter 1 to be array

  • Complete warning is:

    [12-Sep-2016 19:34:53 America/Chicago] PHP Warning: array_unshift() expects parameter 1 to be array, null given in /(path)/wp-includes/class-wp-xmlrpc-server.php on line 596

    I have never seen this warning until version 4.6.1.

    This is where it happens in the code:

    	public function wp_getUsersBlogs( $args ) {
    		// If this isn't on WPMU then just use blogger_getUsersBlogs
    		if ( !is_multisite() ) {
    			array_unshift( $args, 1 );
    			return $this->blogger_getUsersBlogs( $args );

    Any ideas on what might be causing it?

    I suspect normal use of the blog doesn’t cause it, but probably some bot trying to do something hinky. I’ve only seen it a couple times.

    • This topic was modified 5 years, 9 months ago by MarkRH.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator t-p


    What did you do before this issue happened? For example:
    – Did you update WP? Yes? Was it auto update or manual update? Also, updated from what version?
    – Did you install/update plugins?
    – Did you install/update theme?
    – What theme are you using currently? Where did you download it from?
    – Are ALL your plugins and the current theme up to date?
    – Have you moved your site to new server, new domain, or new directory
    – Did your site work without any issue before (No hacking, no error, etc.)?
    – Have you checked your server error logs for any clue or any specific error?

    Thread Starter MarkRH


    I updated manually from version 4.6 to 4.6.1. Jetpack also updated around the same time to v4.3.1. Using Twenty Twelve child theme which has not been updated since version 4.5 of WordPress but it is the current version.

    I’ll probably go edit that code and add some logging to find out what specific URL requests are causing it so I can duplicate it at will.

    I also have a very similar warning on my site error.log . Also the same day.

    [12-Sep-2016 13:18:40 UTC] PHP Warning:  array_unshift() expects parameter 1 to be array, null given in /home/*/public_html/wp-includes/class-wp-xmlrpc-server.php on line 596
    [17-Sep-2016 05:51:35 America/Chicago] PHP Warning:  require(ABSPATHwp-includes/load.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/*/public_html/wp-settings.php on line 21
    Thread Starter MarkRH


    I haven’t seen the error again since then. That file has been accessed a lot though, through xmlrpc.php most likely.

    I’ve seen this error too

    Just saw it in log files – occurred two days ago so don’t really know what I was doing at the time.

    Hi there,

    It’s old error, that happens because this method has not additional check for input variables.

    It’s wp core devs fault.

    You can fix it in next way:
    file: /wp-includes/class-wp-xmlrpc-server.php
    line: ~ 596
    Append type check of $args variable

    	public function wp_getUsersBlogs( $args ) {
                    if (!is_array($args)) {
                        return $this->error;

    JFYI: the discussion of this bug is here:

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘class-wp-xmlrpc-server.php – array_unshift() expects parameter 1 to be array’ is closed to new replies.