From 4d90778861abbb1a2728437841b53a6f73bcc935 Mon Sep 17 00:00:00 2001 From: Ar Rakin <68149013+virtual-designer@users.noreply.github.com> Date: Fri, 18 Feb 2022 14:27:18 +0600 Subject: [PATCH] Fix bug #19235 (#19247) * Fix bug #19235 * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md --- framework/CHANGELOG.md | 2 +- framework/web/SessionIterator.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 66bcb5bee64..dd460ec67e8 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -5,7 +5,7 @@ Yii Framework 2 Change Log ------------------------ - no changes in this release. - +- Bug #19235: Fix return type compatibility of `yii\web\SessionIterator` class methods for PHP 8.1 (virtual-designer) 2.0.45 February 11, 2022 ------------------------ diff --git a/framework/web/SessionIterator.php b/framework/web/SessionIterator.php index d8ccdf71ad0..6d8c5a300ca 100644 --- a/framework/web/SessionIterator.php +++ b/framework/web/SessionIterator.php @@ -37,6 +37,7 @@ public function __construct() * Rewinds internal array pointer. * This method is required by the interface [[\Iterator]]. */ + #[\ReturnTypeWillChange] public function rewind() { $this->_key = reset($this->_keys); @@ -47,6 +48,7 @@ public function rewind() * This method is required by the interface [[\Iterator]]. * @return mixed the key of the current array element */ + #[\ReturnTypeWillChange] public function key() { return $this->_key; @@ -57,6 +59,7 @@ public function key() * This method is required by the interface [[\Iterator]]. * @return mixed the current array element */ + #[\ReturnTypeWillChange] public function current() { return isset($_SESSION[$this->_key]) ? $_SESSION[$this->_key] : null; @@ -66,6 +69,7 @@ public function current() * Moves the internal pointer to the next array element. * This method is required by the interface [[\Iterator]]. */ + #[\ReturnTypeWillChange] public function next() { do { @@ -78,6 +82,7 @@ public function next() * This method is required by the interface [[\Iterator]]. * @return bool */ + #[\ReturnTypeWillChange] public function valid() { return $this->_key !== false;