If search string contains "+" chars, an error occurs. All screen is in garbage
messages such as:

"nothing to repeat at offset 2 modules/trip_search/trip_search.module on line 320"

You can see this problem by clicking the link below:

http://www.icebrains-soft.com and search with "++Skype".

If you enter "\+\+Skype", everything is great. It seems to me, there is a bug in
the Trip Search module

Comments

vitaly_r’s picture

The solution I use is simple enough. First 2 lines in the trip_search_parse function:

$search = str_replace('+', '\\+', $search);
$search = str_replace('*', '\\*', $search);

(The same error occurs when you use '*').

But I am not sure, it is a right way. Because it is impossible to use the power of
regular expressions inside search strings after this patch.

nedjo’s picture

Obvioiusly it would be nice to fix this problem, but maybe the best short term appoach is merely to test for * + ' characters and return an error, saying that searches can't contain these characters.

vitaly_r’s picture

It doesn't seems to me, it will be a good solution.

Why should these symbols be prohibited? My solution (replace '+' and '*' by escaping character '\') is bad because it is impossible to use regular expression in the search string. Your solution makes it impossible to use not only regualr expressions in the search string but also symbols '+' and '*' in the search string. Why?

It seems to me, the right way is to give to the user the ability to search with and without regular expression. For example, basic search will be possible only without regular expressions (all characters with special meanings, such as '+' and '*', will be escaped in this case by the php-script) while advanced search will be possible with regular expressions if user selects this search mode (via check-box, for example).

joel_guesclin’s picture

Status: Active » Closed (fixed)

Is this still an issue? If not, I propose not to treat it for 4.7