Browse Source

Fix bug #19235 (#19247)

* Fix bug #19235

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md
master
Ar Rakin 3 years ago committed by GitHub
parent
commit
4d90778861
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      framework/CHANGELOG.md
  2. 5
      framework/web/SessionIterator.php

2
framework/CHANGELOG.md

@ -5,7 +5,7 @@ Yii Framework 2 Change Log
------------------------ ------------------------
- no changes in this release. - 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 2.0.45 February 11, 2022
------------------------ ------------------------

5
framework/web/SessionIterator.php

@ -37,6 +37,7 @@ class SessionIterator implements \Iterator
* Rewinds internal array pointer. * Rewinds internal array pointer.
* This method is required by the interface [[\Iterator]]. * This method is required by the interface [[\Iterator]].
*/ */
#[\ReturnTypeWillChange]
public function rewind() public function rewind()
{ {
$this->_key = reset($this->_keys); $this->_key = reset($this->_keys);
@ -47,6 +48,7 @@ class SessionIterator implements \Iterator
* This method is required by the interface [[\Iterator]]. * This method is required by the interface [[\Iterator]].
* @return mixed the key of the current array element * @return mixed the key of the current array element
*/ */
#[\ReturnTypeWillChange]
public function key() public function key()
{ {
return $this->_key; return $this->_key;
@ -57,6 +59,7 @@ class SessionIterator implements \Iterator
* This method is required by the interface [[\Iterator]]. * This method is required by the interface [[\Iterator]].
* @return mixed the current array element * @return mixed the current array element
*/ */
#[\ReturnTypeWillChange]
public function current() public function current()
{ {
return isset($_SESSION[$this->_key]) ? $_SESSION[$this->_key] : null; return isset($_SESSION[$this->_key]) ? $_SESSION[$this->_key] : null;
@ -66,6 +69,7 @@ class SessionIterator implements \Iterator
* Moves the internal pointer to the next array element. * Moves the internal pointer to the next array element.
* This method is required by the interface [[\Iterator]]. * This method is required by the interface [[\Iterator]].
*/ */
#[\ReturnTypeWillChange]
public function next() public function next()
{ {
do { do {
@ -78,6 +82,7 @@ class SessionIterator implements \Iterator
* This method is required by the interface [[\Iterator]]. * This method is required by the interface [[\Iterator]].
* @return bool * @return bool
*/ */
#[\ReturnTypeWillChange]
public function valid() public function valid()
{ {
return $this->_key !== false; return $this->_key !== false;

Loading…
Cancel
Save