diff --git a/core/functions.php b/core/functions.php index 6e91cd7..1a48d54 100644 --- a/core/functions.php +++ b/core/functions.php @@ -375,12 +375,10 @@ function cf7a_maybe_split_mail_meta( $posted_data, $message_tag, $explode_patter * @return array $num_array The unsigned integer array. */ function cf7a_str_array_to_uint_array( $str_array ) { - $num_array = array(); - foreach ( $str_array as $value ) { - preg_match( '/^[0-9]+$/', esc_attr( $value ), $matches ); - if ( $matches[0] ) { - $num_array[] = intval( $matches[0] ); + return array_filter( + $str_array, + function ( $value ) { + return is_numeric( $value ) && $value > 0 && intval( $value ) == $value; } - } - return $num_array; + ); }