SQL error occurs when specifying quotes inside search pattern (in this example "p)
user error: You have an error in your SQL syntax near 'p%" OR c.comment LIKE "%"p%") ORDER BY c.timestamp DESC LIMIT 0, 26' at line 1
query: SELECT c.*, u.name FROM comments c INNER JOIN users u ON c.uid = u.uid WHERE c.status = 0 AND (c.subject LIKE "%"p%" OR c.comment LIKE "%"p%") ORDER BY c.timestamp DESC LIMIT 0, 26 in /home/cantincoro/includes/database.mysql.inc on line 125.
Matteo
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | trip_search.patch | 339 bytes | mpd |
| #1 | trip_search_quotes.patch | 744 bytes | matteo |
Comments
Comment #1
matteo commentedWrote a patch to correct the problem.
Here it is
Matteo
Comment #2
michalska commentedDo you have this patch for 4.6? I get the same error. I need to include quotes and apostrophes in my searches, they are not escaped.
Comment #3
matteo commentedUnfortunately not, module has been radically changed..
Comment #4
mpd commentedFor my purposes, this patch fixed single quotes in 4.6.
Comment #5
nedjoThanks Mike, pls go ahead and apply (ideally to 4.6 and to HEAD, although HEAD isn't being updated).
Comment #6
joel_guesclin commentedIn principle this should be fixed in the 4.7 version. I'm closing all requests raised on the 4.6 version since I don't intend to continue maintaining this. Hope this causes no problems.