You are here

public static function SchemaMetatagManager::recomputeSerializedLength in Schema.org Metatag 7

Check if a value looks like a serialized array.

Parameters

string $value: The string value to assess.

Return value

bool TRUE/FALSE.

Overrides SchemaMetatagManagerInterface::recomputeSerializedLength

1 call to SchemaMetatagManager::recomputeSerializedLength()
SchemaMetatagManager::unserialize in src/SchemaMetatagManager.php
Wrapper for unserialize to prevent errors.

File

src/SchemaMetatagManager.php, line 325
A generic substitution for Drupal 8 Random utility.

Class

SchemaMetatagManager
Class SchemaMetatagManager.

Code

public static function recomputeSerializedLength($value) {
  $value = preg_replace_callback('!s:(\\d+):"(.*?)";!', function ($match) {
    return $match[1] == strlen($match[2]) ? $match[0] : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
  }, $value);
  return $value;
}