[wp-trac] [WordPress Trac] #10041: like_escape() should escape backslashes too
WordPress Trac
noreply at wordpress.org
Mon May 19 14:36:40 UTC 2014
#10041: like_escape() should escape backslashes too
---------------------------------+-----------------------------
Reporter: miau_jp | Owner:
Type: defect (bug) | Status: reopened
Priority: high | Milestone: Future Release
Component: Formatting | Version: 2.8
Severity: normal | Resolution:
Keywords: 4.0-early has-patch | Focuses:
---------------------------------+-----------------------------
Comment (by Denis-de-Bernardy):
One last note, in the interest of highlighting differences between MySQL
and Postgres, as the latter is oftentimes much stricter than the former.
Postgres will only resolve the LIKE with backslashes escaped one more time
as below — which none of the suggested functions compute:
{{{
select E'foo\'"\\b\\%_a_%\\\'"r' like E'foo\'"\\\\b\\\\\%\_a\_\%\\\\\'"r';
select 'foo''"\\b\\%_a_%\\''"r' like 'foo''"\\\\b\\\\\%\_a\_\%\\\\''"r';
}}}
MySQL, incidentally, is also happy with the above:
{{{
select 'foo\'"\\b\\%_a_%\\\'"r' like 'foo\'"\\\\b\\\\\%\_a\_\%\\\\\'"r';
select 'foo''"\\b\\%_a_%\\''"r' like 'foo''"\\\\b\\\\\%\_a\_\%\\\\''"r';
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/10041#comment:44>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list