Skip to content

Commit

Permalink
Fixed the condition for checking value of selector (#208)
Browse files Browse the repository at this point in the history
* fixed the condition for checking value of selector

fixed the condition for checking option values ​​for boolean values ​​that are written in selector options as strings

* simplified condition

---------

Co-authored-by: Nikita <[email protected]>
  • Loading branch information
Fellan-91 and nk-o authored May 26, 2024
1 parent bf8f33c commit cf19bd4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion classes/class-security.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,15 @@ public static function sanitize_selector( $attribute, $control ) {
*/
if (
empty( $control['value_callback'] ) &&
! isset( $control['options'][ $attribute ] )
! isset( $control['options'][ $attribute ] ) &&
(
// Additional check for bool and values 'true', 'false'.
! is_bool( $attribute ) ||
(
is_bool( $attribute ) &&
! isset( $control['options'][ $attribute ? 'true' : 'false' ] )
)
)
) {
$attribute = self::reset_control_attribute_to_default( $attribute, $control );
}
Expand Down

0 comments on commit cf19bd4

Please sign in to comment.