Support » Fixing WordPress » Google-hilite bug (and fix)

  • The google-hilite plugin has a bug where an empty search string from the wordpress internal search (i.e., results in the entire URL being sent as the search string. The unescaped slashes then raise a PHP error.
    The fix: Change the preg_replace which is extracting the wordpress search from:
    $query_terms = preg_replace(‘/^.*s=([^&]+)&?.*$/i’,’$1′, $referer);
    $query_terms = preg_replace(‘/^.*s=([^&]+)?.*$/i’,’$1′, $referer);
    (here is the diff -u):
    — google-hilite.php Sat Jul 17 15:08:41 2004
    +++ google-hilite-new.php Sat Jul 17 15:09:45 2004
    @@ -47,7 +47,7 @@
    – $query_terms = preg_replace(‘/^.*s=([^&]+)&?.*$/i’,’$1′, $referer);
    + $query_terms = preg_replace(‘/^.*s=([^&]+)?.*$/i’,’$1′, $referer);
    $query_terms = preg_replace(‘/\’|”/’, ”, $query_terms);
    $query_array = preg_split (“/[\s,\+\.]+/”, $query_terms);
    Charlie DeTar

Viewing 4 replies - 1 through 4 (of 4 total)
  • I have another fix for the google-hilite plugin– if there are any ‘/’s in the search term, the plugin chokes and breaks the display. I inserted this at line 104 to fix it:
    $term = preg_quote($term, '/');

    At the risk of sounding stupid, is this in reference to the one post return not highlighting the searched word?

    Moderator Ryan Boren


    WordPress Dev

    The preg_quote fix is already in CVS.

    I’m assuming that it isn’t in reference to one post returns…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Google-hilite bug (and fix)’ is closed to new replies.