From 378fe37dff32ca006dd039ceb319774c7ab6eef1 Mon Sep 17 00:00:00 2001 From: josephzhao Date: Thu, 18 Jan 2024 14:58:55 -0500 Subject: [PATCH] Update PhpHandler.php for symfony 6 with php-8.3 there are errors for the unserialize --- src/Ratchet/Session/Serialize/PhpHandler.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Ratchet/Session/Serialize/PhpHandler.php b/src/Ratchet/Session/Serialize/PhpHandler.php index b1df356d..3fbe3837 100644 --- a/src/Ratchet/Session/Serialize/PhpHandler.php +++ b/src/Ratchet/Session/Serialize/PhpHandler.php @@ -38,7 +38,15 @@ public function unserialize($raw) { $num = $pos - $offset; $varname = substr($raw, $offset, $num); $offset += $num + 1; - $data = unserialize(substr($raw, $offset)); + $pos2 = strpos($raw, '_sf2_', $offset); + if ($pos2 !== false) { + $rawdata = substr($raw, $offset, $pos2 - $offset); + } else { + $rawdata = substr($raw, $offset); + } + $data = unserialize($rawdata); + + // $data = unserialize(substr($raw, $offset)); $returnData[$varname] = $data; $offset += strlen(serialize($data));