Skip to content

Commit

Permalink
Replace uses of deprecated FILTER_SANITIZE_STRING
Browse files Browse the repository at this point in the history
These all appear to be simply trying to get the value, rather than doing any sanitization. That means that `FILTER_UNSAFE_RAW` is the appropriate replacement.

See https://stackoverflow.com/a/69207369/450127
  • Loading branch information
iandunn committed Oct 18, 2023
1 parent e476f6c commit 687a664
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function save_post( $post_id ) {
check_admin_referer( $nonce_action );

if ( isset( $_POST['tix_type'] ) ) {
$value = filter_input( INPUT_POST, 'tix_type', FILTER_SANITIZE_STRING );
$value = filter_input( INPUT_POST, 'tix_type', FILTER_UNSAFE_RAW );
update_post_meta( $post_id, META_KEY, $value );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ public function send_refund_request( $payment_token ) {
}

$metadata = array(
'Refund reason' => filter_input( INPUT_POST, 'tix_refund_request_reason', FILTER_SANITIZE_STRING ),
'Refund reason' => filter_input( INPUT_POST, 'tix_refund_request_reason', FILTER_UNSAFE_RAW ),
);

// Create a new Idempotency token for the refund request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public static function render_available_fields( $context = 'public', array $fiel
*/
public static function export_to_file() {

$fields = filter_input( INPUT_POST, 'fields', FILTER_SANITIZE_STRING, array( 'flags' => FILTER_REQUIRE_ARRAY ) );
$fields = filter_input( INPUT_POST, 'fields', FILTER_UNSAFE_RAW, array( 'flags' => FILTER_REQUIRE_ARRAY ) );
$action = filter_input( INPUT_POST, 'action' );
$nonce = filter_input( INPUT_POST, self::$slug . '-nonce' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public static function render_admin_page() {
$refresh = filter_input( INPUT_POST, 'refresh', FILTER_VALIDATE_BOOLEAN );
$action = filter_input( INPUT_POST, 'action' );
$nonce = filter_input( INPUT_POST, self::$slug . '-nonce' );
$fields = filter_input( INPUT_POST, 'fields', FILTER_SANITIZE_STRING, array( 'flags' => FILTER_REQUIRE_ARRAY ) );
$fields = filter_input( INPUT_POST, 'fields', FILTER_UNSAFE_RAW, array( 'flags' => FILTER_REQUIRE_ARRAY ) );
$statuses = Meetup_Application::get_post_statuses();

$field_defaults = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public static function render_admin_page() {
public static function export_to_file() {
$start_date = filter_input( INPUT_POST, 'start-date' );
$end_date = filter_input( INPUT_POST, 'end-date' );
$fields = filter_input( INPUT_POST, 'fields', FILTER_SANITIZE_STRING, array( 'flags' => FILTER_REQUIRE_ARRAY ) );
$fields = filter_input( INPUT_POST, 'fields', FILTER_UNSAFE_RAW, array( 'flags' => FILTER_REQUIRE_ARRAY ) );
$action = filter_input( INPUT_POST, 'action' );
$nonce = filter_input( INPUT_POST, self::$slug . '-nonce' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public static function export_to_file() {
$start_date = filter_input( INPUT_POST, 'start-date' );
$end_date = filter_input( INPUT_POST, 'end-date' );
$status = filter_input( INPUT_POST, 'status' );
$fields = filter_input( INPUT_POST, 'fields', FILTER_SANITIZE_STRING, array( 'flags' => FILTER_REQUIRE_ARRAY ) );
$fields = filter_input( INPUT_POST, 'fields', FILTER_UNSAFE_RAW, array( 'flags' => FILTER_REQUIRE_ARRAY ) );
$refresh = filter_input( INPUT_POST, 'refresh', FILTER_VALIDATE_BOOLEAN );
$action = filter_input( INPUT_POST, 'action' );
$nonce = filter_input( INPUT_POST, self::$slug . '-nonce' );
Expand Down
4 changes: 2 additions & 2 deletions public_html/wp-content/plugins/wordcamp-reports/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function add_reports_page() {
* @return void
*/
function render_page() {
$report = filter_input( INPUT_GET, 'report', FILTER_SANITIZE_STRING );
$report = filter_input( INPUT_GET, 'report', FILTER_UNSAFE_RAW );
$report_class = get_report_class_by_slug( $report );

$reports_with_admin = array_filter(
Expand Down Expand Up @@ -255,7 +255,7 @@ function enqueue_admin_assets( $hook_suffix ) {
filemtime( get_assets_dir_path() . 'css/admin-common.css' )
);

$report = filter_input( INPUT_GET, 'report', FILTER_SANITIZE_STRING );
$report = filter_input( INPUT_GET, 'report', FILTER_UNSAFE_RAW );
$report_class = get_report_class_by_slug( $report );

if ( ! is_null( $report_class ) && method_exists( $report_class, 'enqueue_admin_assets' ) ) {
Expand Down

0 comments on commit 687a664

Please sign in to comment.