fix: preserve serialized object payloads
This commit is contained in:
1 parent
4cfc1036bb
commit
d50917d827
2 files changed
+29
-1
No files matched your search
@@ -32,7 +32,7 @@ final class MetadataUrlTransformer {
|
||||
if ( $this->looksSerialized( $value ) ) {
|
||||
$unserialized = $this->unserializeValue( $value );
|
||||
|
||||
if ( ! $unserialized['valid'] || is_object( $unserialized['value'] ) ) {
|
||||
if ( ! $unserialized['valid'] || $this->containsObject( $unserialized['value'] ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -118,4 +118,25 @@ final class MetadataUrlTransformer {
|
||||
|
||||
return '' !== $trimmed && in_array( $trimmed[0], array( '{', '[' ), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value Value to inspect.
|
||||
*/
|
||||
private function containsObject( $value ): bool {
|
||||
if ( is_object( $value ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ! is_array( $value ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $value as $item ) {
|
||||
if ( $this->containsObject( $item ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user