From 87c5b2b947205fd5ce7ece8630617344c705bf94 Mon Sep 17 00:00:00 2001 From: John Doyle Date: Sat, 28 Mar 2020 10:07:34 -0400 Subject: [PATCH] Message-252: Resolves issue with __PHP_Incomplete_Class error due to SA-CORE-2019-003. --- src/Entity/Message.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Entity/Message.php b/src/Entity/Message.php index 13c271e..11db87b 100644 --- a/src/Entity/Message.php +++ b/src/Entity/Message.php @@ -137,12 +137,33 @@ public function getUuid() { return $this->get('uuid')->value; } + /** + * Fix Incomplete Object PHP error caused by SA-CORE-2019-003 security release which + * uses unserialize($values, ['allowed_classes' => FALSE]); and thus turns the unserialized + * object into a "__PHP_Incomplete_Class" object. + * @param $object + * @return mixed + */ + private function fixIncompleteObject($object) { + if(is_object($object) && get_class($object) === "__PHP_Incomplete_Class") { + return ($object = unserialize(serialize($object))); + } + return $object; + } + /** * {@inheritdoc} */ public function getArguments() { $arguments = $this->get('arguments')->first(); - return $arguments ? $arguments->getValue() : []; + if ($arguments){ + $arguments = $arguments->getValue(); + foreach ($arguments as &$option) { + $option = $this->fixIncompleteObject($option); + } + return $arguments; + } + return []; } /**