The fix I could figure out is to replace:

  $stopwords = explode("\n", variable_get('bot_factoid_stopwords', _bot_factoid_stopwords()));

to

  str_replace(array("\r\n","\r"), "\n", $stopwords = explode("\n", variable_get('bot_factoid_stopwords', _bot_factoid_stopwords())));

The difference is depicted here: http://www.drupalbin.com/1922

Comments

Gurpartap Singh’s picture

Title: Exploding custom stopwords may add a carriage return » explode($stopwords) may retain carriage return
Status: Active » Needs review

I had hit submit too fast.

The issue is that when custom stopwords are entered, explode() function with "\n" as separator may not work. However, in such a case "\r\n" as a separator worked for me, although breaking the default format.

This is related to different line breaks in different OS'.

Tested entering settings under Firefox 3 + XP.

Setting status to needs review; this is not really a patch, but there could be a better fix..

Gurpartap Singh’s picture

This one depicts the difference better: http://www.drupalbin.com/1923

morbus iff’s picture

Status: Needs review » Fixed

I've commited a version of this in DRUPAL-6--1. Please test. Thanks!

Gurpartap Singh’s picture

I just realized that the fix in the first post above has syntax error. Anyhow, this is the commit that Morbus made into the module. Might help someone landing on this page :)

  $stopwords = array_map('trim', explode("\n", variable_get('bot_factoid_stopwords', _bot_factoid_stopwords())));
Anonymous’s picture

Status: Fixed » Closed (fixed)

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