Open
Description
I recently upgrade phalcon 4 to 5.4 under PHP 7.4. When run our existing test cases, we are facing incompatibility issues with respect to unserialize
.
Exception:
Fatal error: Declaration of Mockery_11_User::unserialize($string) must be compatible with Phalcon\Mvc\Model::unserialize($serialized): void
Phalcon - 5.4
PHP - 7.4
I tried following code snippet in model
public function serialize(): string
{
$data = array(
'parent' => parent::serialize(),
);
return serialize($data);
}
public function unserialize($str) : void
{
$data = unserialize($str);
parent::unserialize($data['parent']);
unset($data['parent']);
foreach ($data as $key => $value) {
$this->$key = $value;
}
}
Anybody kindly help on this. Thank you