Unserializing the ‘S’ format is deprecated

Description

When using the unserialize() function, the string should not use S (upper case S) to format a string. It should only use s (lower case S).

Other formats, such as i, b or N are already case sensitive.

Example

<?php

$encoded = 'S:3:"abc";';

unserialize($encoded);

?>

Solutions

  • Turn the S into lower case s. This might be tricky.

  • Reserialize all the stored strings with lower case.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See unserialize_S.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See unserialize_S.