I am working on a PHP forum software (FluxBB) and a user encountered a rather interesting error, that - so it seems - PHP is inserting an ellipsis in the middle of a string.
Due to a similar error I found on the net I feel forced to say that this code is situated in a function and that $db
is a global variable.
Here's the (simplified) code:
// Get unique words from the above arrays
$unique_words = array_unique(array_merge($words['add']['post'], $words['add']['subject']));
if (!empty($unique_words))
{
$result = $db->query('SELECT id, word FROM '.$db->prefix.'search_words WHERE word IN('.implode(',', preg_replace('#^(.*)$#', '\'\1\'', $unique_words)).')', true) or error('Unable to fetch search index words', __FILE__, __LINE__, $db->error());
$word_ids = array();
while ($row = $db->fetch_row($result))
$word_ids[$row[1]] = $row[0];
Now, $unique_words
consists of multiple French words (in this case), and the ellipsis gets added right before the comma and behind the closing quote. That must mean it is added during the implode call, which makes no sense at all.
NOTE: Escaping the words is taken care of.
In fact, only PHP can be causing the error, since the query that is spit out by the debugger is saved before being executed.
I'm actually trying to give support, but I cannot come up with a reasonable solution...