Improve clarity and speed of [25320].
git-svn-id: https://develop.svn.wordpress.org/trunk@25338 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cedb15724a
commit
3b314a0adf
@ -262,8 +262,15 @@ function is_serialized( $data, $strict = true ) {
|
|||||||
if ( ';' !== $lastc && '}' !== $lastc )
|
if ( ';' !== $lastc && '}' !== $lastc )
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// ensures ; or } exists but is not in the first X chars
|
$semicolon = strpos( $data, ';' );
|
||||||
if ( strpos( $data, ';' ) < 3 && strpos( $data, '}' ) < 4 )
|
$brace = strpos( $data, '}' );
|
||||||
|
// Either ; or } must exist.
|
||||||
|
if ( false === $semicolon && false === $brace )
|
||||||
|
return false;
|
||||||
|
// But neither must be in the first X characters.
|
||||||
|
if ( false !== $semicolon && $semicolon < 3 )
|
||||||
|
return false;
|
||||||
|
if ( false !== $brace && $brace < 4 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$token = $data[0];
|
$token = $data[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user