• Since the update on my local host I recieved the following errors:
    Warning: explode() expects parameter 2 to be string, array given in C:\wamp\www\wp theme\wp-includes\query.php on line 2390
    and
    Warning: in_array() expects parameter 2 to be array, null given in C:\wamp\www\wp theme\wp-includes\query.php on line 2399

    Now, I don’t know if it actually fixed anything but I edited the file to force an array and it seemed to remove the errors well enough. I don’t know of any adverse affects to doing this yet.

    var_dump($q['post_status']);
    			$statuswheres = array();
    			$q_status = $q['post_status'];//explode(',', $q['post_status']);
    			$r_status = array();
    			$p_status = array();
    			$e_status = array();
    			if ( $q['post_status'] == 'any' ) {
    				foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status )
    					$e_status[] = "$wpdb->posts.post_status <> '$status'";
    			} else {
    				foreach ( get_post_stati() as $status ) {
    					if ( in_array( $status, array($q_status) ) ) {//previously ## if ( in_array( $status, $q_status ) ) {

    I added the dump as a check to see just what is being retrieved. For some reason the original update file recieved the post variable as an array, not a string to use explode() on. This forced the initial $q_status to recieve an error when attempting to build an array using the explode() because explode() expects a string to break apart, not an array…which is what it was recieving.

    As such, the $q_status array wasn’t being set. To further the oddity, the in_array() on line 2399 was being fed $q_status which was a string, not an the expected array.

    Can someone tell me if my temporary solution is, in fact, a solution or if I should expect it to cause errors down the road?

Viewing 15 replies - 1 through 15 (of 28 total)
  • I get that exact same error as well, just upgraded to 3.1.3.

    Will follow along here, and post if I find any solution that doesn’t involve touching the core.

    This is being discussed on Trac #17556 and will be fixed in 3.1.4. As far as I understand it, a change was backported that depended on one that wasn’t.

    Hmm, seems like the core team is aware of it – Trac ticket. Milestone is 3.1.4.

    For anyone else having this problem:
    You can hide this warning with a flag in your .htaccess to suppress warnings & errors:
    php_flag display_errors off

    Note: you probably want to keep this on in your development environment, but on your live site you should hide errors for security measures.

    Same error here. What’s the eta for 3.1.4?

    I got a similar error after I manually upgraded only the changed files. Manually upgrading all of the 3.1.3 package files (some of which were in fact changed but not listed as such) fixed it.

    Same here after an auto-update.

    We likely won’t see 3.1.4 for this, but you can use the following plugin to clear up the error: https://www.ads-software.com/extend/plugins/hotfix/

    In English :
    You can correct this error ?? Edit the file query.php on directory wp-includes of WordPress :
    replace :

    if ( isset($q['post_status']) && $q['post_status'] != '' ) {
    			$statuswheres = array();
    			$q_status = explode(',', $q['post_status']);

    by it :

    if ( ! empty( $q['post_status'] ) ) {
    			$statuswheres = array();
    			$q_status = $q['post_status'];
    			if ( ! is_array( $q_status ) )
    				$q_status = explode(',', $q_status);

    In French / en Fran?ais :
    Vous pouvez corriger cette erreur ?? Editez le fichier query.php dans le dossier wp-includes de WordPress :
    remplacez :

    if ( isset($q['post_status']) && $q['post_status'] != '' ) {
    			$statuswheres = array();
    			$q_status = explode(',', $q['post_status']);

    par ?a :

    if ( ! empty( $q['post_status'] ) ) {
    			$statuswheres = array();
    			$q_status = $q['post_status'];
    			if ( ! is_array( $q_status ) )
    				$q_status = explode(',', $q_status);

    Enjoy xD

    I had the same problem.
    Maya addressed the issue in a very ellegant way.
    Thanks Maya.

    Daya, merci beaucoup!!

    Warning: explode() expects parameter 2 to be string, array given in /home/donmcint/linkedbees.com/wp-includes/query.php on line 2390

    Warning: in_array() expects parameter 2 to be array, null given in /home/donmcint/linkedbees.com/wp-includes/query.php on line 2399

    Warning: in_array() expects parameter 2 to be array, null given in /home/donmcint/linkedbees.com/wp-includes/query.php on line 2399

    Warning: in_array() expects parameter 2 to be array, null given in /home/donmcint/linkedbees.com/wp-includes/query.php on line 2399

    Warning: in_array() expects parameter 2 to be array, null given in /home/donmcint/linkedbees.com/wp-includes/query.php on line 2399

    Warning: in_array() expects parameter 2 to be array, null given in /home/donmcint/linkedbees.com/wp-includes/query.php on line 2399

    Warning: in_array() expects parameter 2 to be array, null given in /home/donmcint/linkedbees.com/wp-includes/query.php on line 2399

    Warning: in_array() expects parameter 2 to be array, null given in /home/donmcint/linkedbees.com/wp-includes/query.php on line 2399

    Warning: in_array() expects parameter 2 to be array, null given in /home/donmcint/linkedbees.com/wp-includes/query.php on line 2399

    Thread Starter unrelatedmedia

    (@unrelatedmedia)

    Now, both Daya and I use the same principle to solve the problem, with 2 different approaches. The question remains – does this actually solve the issue or have any adverse effects?

    @Tim- that plug-in worked perfectly. Thanks!

    Could there potentionally be a problem with using Daya’s solution?

    The hotfix plugin resolved it for me as well (https://www.ads-software.com/extend/plugins/hotfix/). Thanks Tim.

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘[UPDATE Error]wp-includes/query.php array line 2390’ is closed to new replies.