Google-hilite bug (and fix)
-
The google-hilite plugin has a bug where an empty search string from the wordpress internal search (i.e., http://myblog.com/?s=) 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);
to:
$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 @@
break;
}
– $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);
break;
Thanks,
Charlie DeTar
The topic ‘Google-hilite bug (and fix)’ is closed to new replies.