Skip to content

Commit b763a0d

Browse files
committed
Use sanitize_key() instead of sanitize_text_field() for AJAX action.
1 parent 32cdb3c commit b763a0d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Admin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function add_admin_bar_menu( $wp_admin_bar ): void {
141141
public function handle_actions() {
142142
global $wp_object_cache;
143143

144-
$action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : '';
144+
$action = isset( $_GET['action'] ) && is_string( $_GET['action'] ) ? sanitize_key( $_GET['action'] ) : '';
145145
if ( ! in_array( $action, [ 'object_cache_enable', 'object_cache_disable', 'object_cache_flush' ], true ) ) {
146146
return;
147147
}
@@ -164,6 +164,7 @@ public function handle_actions() {
164164
if ( ! class_exists( Object_Cache_Annihilator::class ) ) {
165165
require_once \OBJECT_CACHE_ANNIHILATOR_DIR . '/drop-in.php';
166166
}
167+
167168
Object_Cache_Annihilator::instance()->resurrect();
168169
if ( $wp_object_cache instanceof Object_Cache_Annihilator ) {
169170
$notice_message = __( 'Object cache enabled successfully.', 'object-cache-annihilator' );

0 commit comments

Comments
 (0)