From 891b01ecb80089f10d3accb2efaa6ce96afd05f3 Mon Sep 17 00:00:00 2001 From: Martin Price Date: Fri, 30 Jan 2026 11:00:22 +0000 Subject: [PATCH] Issue #475: Fix PHP 8.4 error handling deprecations --- CHANGELOG.md | 3 ++- bee.php | 4 ++-- includes/errors.inc | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c116bb2..2f9be567 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project follows the which is based on the major version of Backdrop CMS with a semantic version system for each contributed module, theme and layout. -## [Unreleased] - 2025-08-30 +## [Unreleased] - 2026-01-30 ### Added - An option for the `db-import` command to allow import from newer MariaDB @@ -23,6 +23,7 @@ layout templates or Backdrop itself. - Unhandled errors and warnings if commands run outside Backdrop root and/or before installing Backdrop. - Error if importing config to database config storage. +- Deprecations within error handling for PHP 8.4. ### Changed - Bee will now notify the user of additional modules that will be enabled or disabled diff --git a/bee.php b/bee.php index d3a9001d..a1150c57 100755 --- a/bee.php +++ b/bee.php @@ -46,13 +46,13 @@ * The file that the error came from. * @param int $line * The line number the error came from. - * @param array $context + * @param array|null $context * An array of all variables from where the error was triggered. * * @see https://www.php.net/manual/en/function.set-error-handler.php * @see _backdrop_error_handler() */ -function bee_error_handler($error_level, $message, $filename, $line, array $context = NULL) { +function bee_error_handler($error_level, $message, $filename, $line, ?array $context = NULL) { require_once __DIR__ . '/includes/errors.inc'; _bee_error_handler_real($error_level, $message, $filename, $line, $context); } diff --git a/includes/errors.inc b/includes/errors.inc index 062353b1..fc43f759 100644 --- a/includes/errors.inc +++ b/includes/errors.inc @@ -73,13 +73,13 @@ define('BEE_WATCHDOG_DEPRECATED', 8); * The file that the error came from. * @param int $line * The line number the error came from. - * @param array $context + * @param array|null $context * An array of all variables from where the error was triggered. * * @see https://www.php.net/manual/en/function.set-error-handler.php * @see _backdrop_error_handler_real() */ -function _bee_error_handler_real($error_level, $message, $filename, $line, array $context = NULL) { +function _bee_error_handler_real($error_level, $message, $filename, $line, ?array $context = NULL) { if ($error_level & error_reporting()) { $types = _bee_error_levels(); @@ -208,7 +208,6 @@ function _bee_error_levels() { E_USER_ERROR => array('User error', BEE_WATCHDOG_ERROR), E_USER_WARNING => array('User warning', BEE_WATCHDOG_WARNING), E_USER_NOTICE => array('User notice', BEE_WATCHDOG_NOTICE), - E_STRICT => array('Strict warning', BEE_WATCHDOG_DEBUG), E_RECOVERABLE_ERROR => array('Recoverable fatal error', BEE_WATCHDOG_ERROR), E_DEPRECATED => array('Deprecated function', BEE_WATCHDOG_DEBUG), E_USER_DEPRECATED => array('User deprecated function', BEE_WATCHDOG_DEBUG),