Opened 5 years ago
Closed 5 years ago
#48843 closed defect (bug) (duplicate)
wpdb::placeholder_escape fails to conditionally add a remove_placeholder_escape hook to query
Reported by: | pcfreak30 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8.3 |
Component: | Database | Keywords: | |
Focuses: | Cc: |
Description
Found this edge case issue while doing some hacking around the wp hook structures/API.
You have:
<?php if ( ! has_filter( 'query', array( $this, 'remove_placeholder_escape' ) ) ) { add_filter( 'query', array( $this, 'remove_placeholder_escape' ), 0 ); }
However, has_filter returns the priority of hook if it exists, which happens to be 0... 0 is falsely in PHP, so every call to placeholder_escape re-sets the array hook ad add_filter doesn't do an exists check, and not sure it even should?
Since we are adding to a priority 0, we need to do a strict #!php false !==
.
I will probably submit a patch shortly.
The function in question was committed with the bug in ticket #41925.
Change History (2)
Note: See
TracTickets for help on using
tickets.
Woops, I mean
false ===