Skip to content

Commit

Permalink
Fix - Partial revoke of security fix regarding serialized objects - H…
Browse files Browse the repository at this point in the history
…as issues with Page Builders corrupting data, plus WordPress itself handles serialized data the same.
  • Loading branch information
bschuiling committed Sep 21, 2023
1 parent 6f95a46 commit 09712fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/shortpixel/replacer/src/Replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ private function replaceContent($content, $search, $replace, $in_deep = false)
if ( true === is_serialized($content))
{
$serialized_content = $content; // use to return content back if incomplete classes are found, prevent destroying the original information
$content = Unserialize::unserialize($content, array('allowed_classes' => false));
$content = Unserialize::unserialize($content);
// bail directly on incomplete classes. In < PHP 7.2 is_object is false on incomplete objects!
if (true === $this->checkIncomplete($content))
{
Expand Down Expand Up @@ -500,7 +500,7 @@ private function findNearestSize($sizeName)
/* Check if given content is JSON format. */
private function isJSON($content)
{
if (is_array($content) || is_object($content))
if (is_array($content) || is_object($content) || is_null($content))
return false; // can never be.

$json = json_decode($content);
Expand Down

0 comments on commit 09712fc

Please sign in to comment.