maybe_unserialize() – Unserialize data only if it was serialized.

You appear to be a bot. Output may be restricted

Description

Unserializes data only if it was serialized.

Usage

$mixed = maybe_unserialize( $data );

Parameters

$data
( string ) required – Data that might be unserialized.

Returns

mixed Unserialized data can be any type.

Source

File name: wordpress/wp-includes/functions.php
Lines:

1 to 7 of 7
function maybe_unserialize( $data ) {
  if ( is_serialized( $data ) ) { // Don't attempt to unserialize data that wasn't serialized going in.
    return @unserialize( trim( $data ) );
  }

  return $data;
}
 

 View on GitHub View on Trac