Skip to content

Commit 9955b87

Browse files
committed
Options, Meta APIs: Add SQL escaping to query loading 'all options'.
Escapes the return value of `wp_autoload_values_to_autoload()` for use in the database query loading 'all options'. This is a hardening fix to protect against future changes to the options API which may allow developers to further customize the return value of the `wp_autoload_values_to_autoload` filter. Follow up to [57920]. Props peterwilsoncc, joemcgill. Fixes #42441. git-svn-id: https://develop.svn.wordpress.org/trunk@58380 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8cd24bc commit 9955b87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wp-includes/option.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ function wp_load_alloptions( $force_cache = false ) {
606606

607607
if ( ! $alloptions ) {
608608
$suppress = $wpdb->suppress_errors();
609-
$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload IN ( '" . implode( "', '", wp_autoload_values_to_autoload() ) . "' )" );
609+
$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload IN ( '" . implode( "', '", esc_sql( wp_autoload_values_to_autoload() ) ) . "' )" );
610610

611611
if ( ! $alloptions_db ) {
612612
$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );

0 commit comments

Comments
 (0)