From 4b0a02e69c07182042b0c224ab160ac441d20f72 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 12 Jul 2024 18:48:05 +0400 Subject: [PATCH] Fix #20147: Fix error handler compatibility with PHP 8.3 (#20228) --- framework/CHANGELOG.md | 1 + framework/base/ErrorHandler.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 874f86dc377..fda96ccd2cd 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -9,6 +9,7 @@ Yii Framework 2 Change Log - Bug #20191: Fix `ActiveRecord::getDirtyAttributes()` for JSON columns with multi-dimensional array values (brandonkelly) - Bug #20211: Add acceptable parameters to `MaskedInput::init()` method (alxlnk) - Bug #20226: Revert all PR for "Data providers perform unnecessary COUNT queries that negatively affect performance" (@terabytesoftw) +- Bug #20147: Fix error handler compatibility with PHP 8.3 (samdark) 2.0.50 May 30, 2024 diff --git a/framework/base/ErrorHandler.php b/framework/base/ErrorHandler.php index 393438ede57..c31cd058bcc 100644 --- a/framework/base/ErrorHandler.php +++ b/framework/base/ErrorHandler.php @@ -279,13 +279,13 @@ public function handleError($code, $message, $file, $line) */ public function handleFatalError() { - unset($this->_memoryReserve); + $this->_memoryReserve = null; - if (isset($this->_workingDirectory)) { + if (!empty($this->_workingDirectory)) { // fix working directory for some Web servers e.g. Apache chdir($this->_workingDirectory); // flush memory - unset($this->_workingDirectory); + $this->_workingDirectory = null; } $error = error_get_last();