Skip to content

Commit f87acba

Browse files
committed
Improved: Prevent notice in save_options()
Fixed: patched minor XSS risk in clean()
1 parent 77ba6c3 commit f87acba

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/Ajax.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private function clean( $var, $key = '' ) {
127127

128128
// If the variable has a scheme (e.g. http:// or https://), sanitize the variable using the esc_url_raw function.
129129
if ( isset( $parsed['scheme'] ) ) {
130-
return esc_url_raw( wp_unslash( $var ), [ $parsed['scheme'] ] );
130+
return esc_url_raw( wp_unslash( $var ) );
131131
}
132132

133133
// If the variable does not have a scheme, sanitize the variable using the sanitize_text_field function.
@@ -317,10 +317,11 @@ function ( $option ) {
317317
);
318318

319319
if ( count( $input_array_elements ) > 0 ) {
320-
$options = [];
321-
$array_name = preg_replace( '/\[[0-9]+]/', '', $input_array_elements[0]->name );
322-
$options[0] = (object) [];
323-
$options[0]->name = $array_name;
320+
$options = [];
321+
$array_name = preg_replace( '/\[[0-9]+]/', '', $input_array_elements[0]->name );
322+
$options[0] = (object) [];
323+
$options[0]->name = $array_name;
324+
$options[0]->value = [];
324325

325326
foreach ( $input_array_elements as $input_array_element ) {
326327
if ( $input_array_element->value ) {

0 commit comments

Comments
 (0)