From 4792d120692846ec0acc5562d3c59a9826cd694a Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Wed, 31 Jul 2024 17:42:19 +0100 Subject: [PATCH] Fix PHP 8.2/8.3 warnings and deprecations --- include/functions.php | 6 +++--- src/Database/Statement.php | 1 + www/bug.php | 4 ++-- www/search.php | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/functions.php b/include/functions.php index f03ddb04..381dbc57 100644 --- a/include/functions.php +++ b/include/functions.php @@ -334,7 +334,7 @@ function field($n) { return oneof(isset($_POST['in']) ? htmlspecialchars(isset($_POST['in'][$n]) ? $_POST['in'][$n] : '') : null, - htmlspecialchars($GLOBALS['bug'][$n])); + htmlspecialchars($GLOBALS['bug'][$n] ?? '')); } /** @@ -656,7 +656,7 @@ function ($value) { foreach ($bug_groups as $key => $bug_group) { - echo ""; array_unshift($bug_group[2], $key); @@ -1240,7 +1240,7 @@ function get_package_mail($package_name, $bug_id = false, $bug_type = 'Bug') // Security problems *always* go to the sec team $to[] = $secBugEmail; foreach ($security_distro_people as $user) { - $to[] = "${user}@php.net"; + $to[] = "{$user}@php.net"; } $params = '-f bounce-no-user@php.net'; } diff --git a/src/Database/Statement.php b/src/Database/Statement.php index f967ef9f..3a99d754 100644 --- a/src/Database/Statement.php +++ b/src/Database/Statement.php @@ -13,6 +13,7 @@ class Statement extends \PDOStatement * \PDOStatement::execute(), on the other hand, returns boolean. Change it * to return $this and thus allow further method chaining. */ + #[\ReturnTypeWillChange] public function execute($parameters = null): self { parent::execute($parameters); diff --git a/www/bug.php b/www/bug.php index aa90dbed..7e784c33 100644 --- a/www/bug.php +++ b/www/bug.php @@ -686,7 +686,7 @@ ', htmlspecialchars($bug['assign']); ?> (profile) - + @@ -701,7 +701,7 @@ PHP Version: OS: - + diff --git a/www/search.php b/www/search.php index 38ad03b7..91b0488a 100644 --- a/www/search.php +++ b/www/search.php @@ -10,7 +10,7 @@ // Redirect early if a bug id is passed as search string if (isset($_GET['search_for']) && preg_match('/^\d+$/', trim($_GET['search_for']), $search_for_id_array)) { - redirect("bug.php?id=${search_for_id_array[0]}"); + redirect("bug.php?id={$search_for_id_array[0]}"); } // For bug count only, used in places like doc.php.net @@ -162,7 +162,7 @@ echo ' ', format_date(strtotime($row['ts1'])), "\n"; // Last Modified - $ts2 = strtotime($row['ts2']); + $ts2 = strtotime($row['ts2'] ?? date('Y-m-d H:i:s')); echo ' ' , ($ts2 ? format_date($ts2) : 'Not modified') , "\n"; // Package