fix: preserve serialized object payloads
This commit is contained in:
@@ -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