[wp-trac] [WordPress Trac] #10041: like_escape() should escape backslashes too

WordPress Trac noreply at wordpress.org
Tue Jun 10 21:42:36 UTC 2014

#10041: like_escape() should escape backslashes too
 Reporter:  miau_jp              |       Owner:  wonderboymusic
     Type:  defect (bug)         |      Status:  closed
 Priority:  high                 |   Milestone:  4.0
Component:  Formatting           |     Version:  2.8
 Severity:  normal               |  Resolution:  fixed
 Keywords:  4.0-early has-patch  |     Focuses:

Comment (by johnjamesjacoby):

 [https://buddypress.trac.wordpress.org/ticket/5701 A note] from Boone
 about deprecating `like_escape()` for a class method that's newly
 introduced in 4.0, and repercussions it will have for plugin authors:

 > Given that the function is deprecated *and* its replacement is
 introduced in 4.0, plugin authors can't just swap it out and still support
 earlier versions of WP. So either we:
 > * do nothing and just live with the deprecated notices, at least until
 we drop support for WP < 4.0
 > * create a wrapper function that does the necessary check and
 find/replace deprecated calls
 > As much as I find the latter option unpleasant, I think it's probably
 the right way to go.

 In the past, we would go a few releases before adding deprecated notices
 to functions similar to this one (see: r13096 and #11388) – worth doing
 the same here?

 Consider also that using `like_escape()` did not previously require a
 touch to the `$wpdb` global that's now required using the new
 `$wpdb->esc_like()` method. Is there any objection to a general
 `esc_like_sql()` function that does the global touch for us, and making
 `like_escape()` a wrapper for it?

Ticket URL: <https://core.trac.wordpress.org/ticket/10041#comment:61>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list