-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Remove placeholders. #3448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove placeholders. #3448
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3088,10 +3088,12 @@ public function get_posts() { | |||||||||||||
| $cache_args['update_post_meta_cache'], | ||||||||||||||
| $cache_args['update_post_term_cache'], | ||||||||||||||
| $cache_args['lazy_load_term_meta'], | ||||||||||||||
| $cache_args['update_menu_item_cache'] | ||||||||||||||
| $cache_args['update_menu_item_cache'], | ||||||||||||||
| $cache_args['search_orderby_title'] | ||||||||||||||
| ); | ||||||||||||||
|
|
||||||||||||||
| $new_request = str_replace( $fields, "{$wpdb->posts}.*", $this->request ); | ||||||||||||||
| $new_request = $wpdb->remove_placeholder_escape( $new_request ); | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That might be harmless in the end, but I thought it was worth flagging just because any filter added to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Looks like it, I ran this in a private window on the front end and it the filter was set: add_action( 'init', function() {
global $wp_filter;
var_dump( $wp_filter[ 'query' ] );
exit;
} );There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking that not all queries might generate a call to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prepare is called within the WP_Query class.
wordpress-develop/src/wp-includes/class-wp-query.php Lines 1574 to 1575 in 70dedb0
Not just in context where LIKE is used. |
||||||||||||||
| $key = md5( serialize( $cache_args ) . $new_request ); | ||||||||||||||
|
|
||||||||||||||
| $last_changed = wp_cache_get_last_changed( 'posts' ); | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -2413,12 +2413,17 @@ public function log_query( $query, $query_time, $query_callstack, $query_start, | |||||||
| * Generates and returns a placeholder escape string for use in queries returned by ::prepare(). | ||||||||
| * | ||||||||
| * @since 4.8.3 | ||||||||
| * @since 6.1.0 Added `$reset` parameter. | ||||||||
| * | ||||||||
| * @param bool $reset Optional. Whether to reset the placeholder. Default false. | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Also needs a |
||||||||
| * | ||||||||
| * @return string String to escape placeholders. | ||||||||
| */ | ||||||||
| public function placeholder_escape() { | ||||||||
| public function placeholder_escape( $reset = false ) { | ||||||||
| static $placeholder; | ||||||||
|
|
||||||||
| if ( $reset ) { | ||||||||
| $placeholder = null; | ||||||||
| } | ||||||||
| if ( ! $placeholder ) { | ||||||||
| // If ext/hash is not present, compat.php's hash_hmac() does not support sha256. | ||||||||
| $algo = function_exists( 'hash' ) ? 'sha256' : 'sha1'; | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.