Skip to content

Commit 4f10ca7

Browse files
Remove dependency on Zend. Add ReturnTypeWillChange annotation to suppress warnings in PHP 8.2
1 parent ad2cfeb commit 4f10ca7

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

app/code/community/Cm/RedisSession/Model/Session.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030
*/
3131

32-
class Cm_RedisSession_Model_Session implements \Zend_Session_SaveHandler_Interface
32+
class Cm_RedisSession_Model_Session implements SessionHandlerInterface
3333
{
3434

3535
const FLAG_READ_ONLY = 'cm-redissession-read-only';
@@ -96,12 +96,13 @@ public static function setStaticSaveHandler()
9696
* @return bool
9797
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
9898
*/
99+
#[\ReturnTypeWillChange]
99100
public function open($savePath, $sessionName)
100101
{
101102
try {
102103
return $this->sessionHandler->open($savePath, $sessionName);
103104
} catch (Throwable $e) {
104-
$this->handleException($e);
105+
throw $this->handleException($e);
105106
}
106107
}
107108

@@ -111,6 +112,7 @@ public function open($savePath, $sessionName)
111112
* @param string $sessionId
112113
* @return string|bool
113114
*/
115+
#[\ReturnTypeWillChange]
114116
public function read($sessionId)
115117
{
116118
try {
@@ -119,7 +121,7 @@ public function read($sessionId)
119121
return $data;
120122
} catch (Throwable $e) {
121123
self::$failedLockAttempts = $this->sessionHandler->getFailedLockAttempts();
122-
$this->handleException($e);
124+
throw $this->handleException($e);
123125
}
124126
}
125127

@@ -130,6 +132,7 @@ public function read($sessionId)
130132
* @param string $sessionData
131133
* @return boolean
132134
*/
135+
#[\ReturnTypeWillChange]
133136
public function write($sessionId, $sessionData)
134137
{
135138
return $this->sessionHandler->write($sessionId, $sessionData);
@@ -141,6 +144,7 @@ public function write($sessionId, $sessionData)
141144
* @param string $sessionId
142145
* @return boolean
143146
*/
147+
#[\ReturnTypeWillChange]
144148
public function destroy($sessionId)
145149
{
146150
return $this->sessionHandler->destroy($sessionId);
@@ -151,6 +155,7 @@ public function destroy($sessionId)
151155
*
152156
* @return bool
153157
*/
158+
#[\ReturnTypeWillChange]
154159
public function close()
155160
{
156161
return $this->sessionHandler->close();
@@ -162,14 +167,15 @@ public function close()
162167
* @param int $maxLifeTime ignored
163168
* @return boolean
164169
*/
170+
#[\ReturnTypeWillChange]
165171
public function gc($maxLifeTime)
166172
{
167173
return $this->sessionHandler->gc($maxLifeTime);
168174
}
169175

170176
/**
171177
* @param Throwable $e
172-
* @return void
178+
* @return Throwable
173179
*/
174180
protected function handleException(Throwable $e)
175181
{
@@ -185,6 +191,6 @@ protected function handleException(Throwable $e)
185191
} else if ($this->dieOnError) {
186192
Mage::printException($e);
187193
}
188-
throw $e;
194+
return $e;
189195
}
190196
}

0 commit comments

Comments
 (0)