Show quoted text> Why are you using quotemeta here?
quotemeta() is currently in use in the Bugzilla code, which I'm
contributing to. The context in which it's used is available here:
http://mxr.mozilla.org/mozilla/source/webtools/bugzilla/Bugzilla/Search.pm#878
We use quotemeta() to escape characters before using the string in a
regexp. I don't know if $dbh->quote() already escapes everything which
is required to be used in regexp, which is why quotemeta() is called first.
Show quoted text> Please describe in detail what sort of crash occurs.
The problem is described here:
https://bugzilla.mozilla.org/show_bug.cgi?id=461729
And the error is:
DBD::Pg::st execute failed: ERREUR: erreur de syntaxe sur ou près de «
foo »
LINE 1: ...EOPENED') ) AND (bugs.keywords ~* '(^|[^a-z0-9])E'foo\\-bar(...
The relevant part of the SQL query is:
WHERE (( bugs.bug_status IN ('NEW','ASSIGNED','REOPENED') ) AND
(bugs.keywords ~* '(^|[^a-z0-9])E'foo\\-bar($|[^a-z0-9])'))
You should in general be using placeholders, and not
Show quoted text> trying to construct queries from the output of quote().
I know that, and our modern code does this. But in the case of
Search.pm, that's pretty hard to do.
I use PostgreSQL 8.3.4 and tried both DBD::Pg 2.10.3 and 2.11.2.