Opened 11 years ago
Closed 11 years ago
#5701 closed defect (bug) (fixed)
like_escape() is deprecated as of WP 4.0
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | has-patch |
Cc: |
Description
See https://core.trac.wordpress.org/ticket/10041 and https://core.trac.wordpress.org/changeset/28711
It's causing our Travis CI trunk builds to due due to unexpected deprecated notices: https://travis-ci.org/buddypress/BuddyPress/builds/27215588
For the moment, I'm going to mark these tests with expectedDeprecated, so we can get our build passing again.
For 2.1, we should have a proper solution. Given that the function is deprecated *and* its replacement is introduced in 4.0, we 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
- We create a wrapper function
bp_esc_like()
that does the necessary check
As much as I find the latter option unpleasant, I think it's probably the right way to go. Feedback welcome.
Attachments (1)
Change History (12)
#3
@
11 years ago
So, it turns out that adding the @expectedDeprecated
flags fixes the build for trunk, but actually breaks it for older versions where the function is not in fact deprecated. I'm going to revert r8496 and r8497 and we'll just have to live with failing builds for a while, until we have a real solution.
#8
@
11 years ago
- Keywords has-patch added
5701.patch adds the proposed bp_esc_like()
wrapper function, and implements throughout BuddyPress. For the most part, this was fairly straightforward, though there were a few places where query structure had to be rearranged to make sure that strings like LIKE '%foo%'
weren't getting run through $wpdb->prepare()
again (which would strip the %
marks).
I've written unit tests for all instances of like_escape()
that weren't already covered (see r8506, r8506), with the exception of those that are specific to bbPress 1.x (I don't feel much like figuring out how to install bbPress during automated testing).
I'd like to have a sanity check from another dev that this is the route we want to take before committing the changes. As I see it, this is kinda our only choice.
#9
@
11 years ago
I haven't heard from any other devs, but I've heard it through the grapevine that WP is going ahead with the current changes for 4.0, so I think we have no choice but to adopt the patch I've put here. I'm going to commit it (so we can get our CI tests passing again) and if anyone has an issue with the nature of the fix, we can have another look at it.
See r8496 for expectedDeprecated flags.