Skip to:
Content
Pages
Categories
Search
Top
Bottom

rawurlencode() Error

  • PHP Warning: rawurlencode() expects parameter 1 to be string, array given in /home/spider/public_html/wp/wp-includes/classes.php on line 1658

    Well i have that problem when i integrate my bbpress with wordpress. It only happen when i view “manage->post” and “manage->pages”. I already edit the classes.php and it only fix my “manage->post”. My “manage->pages” are still broken.

    If i disable the integration, everything work perfectly without any error. Anyone know how to fix this thing?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Well, I came up with an ugly fix, especially since I don’t actually know what I’m doing.

    I’ve been trying to integrate the BBpress forum right inside my WP theme, which is what I imagine you were trying to do.

    To fix it I added this switch right at the top of my bbpress template header:

    $bbpressswitch = 1;

    unset($_SERVER);

    Then I went into classes.php for wordpress and put an if/else ‘switch’, basically:

    The first line there is 1645 in my file

    function build_query_string() {

    $this->query_string = ”;

    foreach ($this->public_query_vars as $wpvar) {

    if (isset($this->query_vars[$wpvar]) && ” != $this->query_vars[$wpvar]) {

    $this->query_string .= (strlen($this->query_string) < 1) ? ” : ‘&’;

    // bug fix for BBpress integration

    if ($bbpressswitch == 1) {

    // $this->query_string .= $wpvar . ‘=’ . rawurlencode($this->query_vars[$wpvar]);

    // if the url is being accessed from a page outside of WP that is using the header

    // or other data, turn off this URL encoding.

    } else {

    $this->query_string .= $wpvar . ‘=’ . rawurlencode($this->query_vars[$wpvar]);

    }

    // end of bug fix

    }

    }

    It’s ugly, and I’m a n00b at this stuff, but it does seem to have cleaned up my error. I guess the bbpress URL’s don’t work so good when sent through the WP URLencode setup, so turning them off when going into a BBpress page seemed like it might work.

    I don’t know if there are any other repurcussions from this change, but again, it turned off the error, and I haven’t seen any fallout…yet.

    There are other sites online that seem to offer a fix for the same issue, like this:

    http://forum.j-prosolution.com/openwp-bugreport/2637-warning-rawurlencode-expects-parameter-1-string.html

    But the fix they suggest kills all of your static pages or category links and always sends you to the main blog page.

    Ok, I lied, that actually doesn’t fix the problem.

    However, what does seem to work is error supression:

    $this->query_string .= $wpvar . ‘=’ . @rawurlencode($this->query_vars[$wpvar]);

    Just throw an @ sign in front of the offending rawurlencode function and it seems to clean things up.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar