From f24a7086abc4b11904e7c1a6278e8a55803b3770 Mon Sep 17 00:00:00 2001 From: CLAlberto <47036379+CLAlberto@users.noreply.github.com> Date: Tue, 6 May 2025 16:16:22 +0200 Subject: [PATCH] fix(read.php): replace deprecated FILTER_SANITIZE_STRING for PHP 8.3 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Problem The usage of `FILTER_SANITIZE_STRING` in `read.php` causes a deprecation warning in PHP 8.1 and breaks functionality entirely in PHP 8.3, as the constant was removed. ### Solution This commit replaces: ```php filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); with a safer and future-proof alternative: $id = filter_input(INPUT_GET, 'id', FILTER_UNSAFE_RAW); $id = trim(strip_tags($id)); > _Thanks for maintaining this project! Happy to contribute._ 😊 --- src/read.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/read.php b/src/read.php index 4a98a77..07e2503 100644 --- a/src/read.php +++ b/src/read.php @@ -5,8 +5,9 @@ if ($_SERVER["REQUEST_METHOD"] !== "GET" || !isset($_GET['id'])) { die("Method not allowed. Check id parameter"); } -// Validation and sanitization of the input -$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); +// Validation and sanitization of the input UPDATE to php 8.3 +$id = filter_input(INPUT_GET, 'id', FILTER_UNSAFE_RAW); +$id = trim(strip_tags($id)); if (!$id) { die("Invalid ID parameter");