Skip to content

Commit 7bc7bab

Browse files
committed
Fixes for replacer issues
1 parent ca03715 commit 7bc7bab

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

build/shortpixel/replacer/src/Libraries/Unserialize/DisallowedClassesSubstitutor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace EnableMediaReplace\Replacer\Libraries;
2+
namespace EnableMediaReplace\Replacer\Libraries\Unserialize;
33

44

55
/**

build/shortpixel/replacer/src/Replacer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@ private function replaceContent($content, $search, $replace, $in_deep = false)
319319
{
320320
$serialized_content = $content; // use to return content back if incomplete classes are found, prevent destroying the original information
321321
$content = Unserialize::unserialize($content, array('allowed_classes' => false));
322+
// bail directly on incomplete classes. In < PHP 7.2 is_object is false on incomplete objects!
323+
if (true === $this->checkIncomplete($content))
324+
{
325+
return $serialized_content;
326+
}
322327
}
323328

324329
$isJson = $this->isJSON($content);

0 commit comments

Comments
 (0)