After running cron I get a series of 20+ error messages saying:

warning: Parameter 1 to porterstemmer_search_preprocess() expected to be a reference, value given in C:\xampp\htdocs\jumpstart\includes\module.inc on line 450.

I am running Drupal 6.14 on XAMPP:
MySQL database 5.1.37
PHP 5.3.0
Web server Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0

Unfortunately I don't know enough to know the cause, although my guess is that it relates to PHP 5.3 after reading through this thread: http://drupal.org/node/360605

Wish I could help more.

Comments

Archnemysis’s picture

Changing line 16 of porterstemmer.module from:

function porterstemmer_search_preprocess(&$text) {

to

function porterstemmer_search_preprocess(&$text) {

solves the problem in PHP 5.3. After making that change, then forcing a re-index and running cron again I get no errors.

However, I don't understand the change I made, and based on comments in other threads doing so may cause an error with PHP 4.

jhodgdon’s picture

I don't see the difference between the two lines you put in there? Presumably you meant to remove the & in the second version.

I just took a look at the doc for http://api.drupal.org/api/function/hook_search_preprocess/6 and it indeed says we should not have a & in the function header (i.e. that function is supposed to pass its arguments by value not by reference). So we should remove it in porterstemmer_search_preprocess().

So... I don't have time to take care of this for a couple of days, but will do so then. I'll need to test and make sure that everything works, but it should.

Thanks for reporting this issue!

jhodgdon’s picture

Assigned: Unassigned » jhodgdon

Note to self: Also need to write a functional test for Porter Stemmer to test regressions for cases like this. It should create some content, index it with cron, and verify it can be searched. I wrote similar tests recently for the Search by Page module, so should be able to crib them to create this test. (The current tests verify that the stemming algorithm is implemented correctly, but they don't actually test the practicalities of the module, such as searching for walk, walks, walking, and walked and verifying they all return a page with one of those words in it.)

Archnemysis’s picture

Woops! Sorry about that Jennifer, I did mean to remove the & from the second line so that it reads:

function porterstemmer_search_preprocess($text) {

Darn Copy/paste.

jhodgdon’s picture

Status: Active » Fixed

This is fixed, and the fix (along with a new functional test) will be in the 6.x-2.5 release (which will be available in about 10 minutes). Thanks again for the issue report.

Status: Fixed » Closed (fixed)
Issue tags: -PHP 5.3

Automatically closed -- issue fixed for 2 weeks with no activity.