Speed up is_serialized() with strpbrk(). Props Rasmus. see #14429
git-svn-id: https://develop.svn.wordpress.org/trunk@15636 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
df6d5550db
commit
d46e7dbfc0
|
@ -234,8 +234,16 @@ function is_serialized( $data ) {
|
||||||
$data = trim( $data );
|
$data = trim( $data );
|
||||||
if ( 'N;' == $data )
|
if ( 'N;' == $data )
|
||||||
return true;
|
return true;
|
||||||
if ( !preg_match( '/^([adObis]):/', $data, $badions ) )
|
if ( function_exists('strpbrk') ) {
|
||||||
|
if ( strlen($data) > 1 && strpbrk($data,'adObis') == $data && $data[1] == ':' ) {
|
||||||
|
$badions = array();
|
||||||
|
$badions[1] = $data[0];
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
} elseif ( !preg_match( '/^([adObis]):/', $data, $badions ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
switch ( $badions[1] ) {
|
switch ( $badions[1] ) {
|
||||||
case 'a' :
|
case 'a' :
|
||||||
case 'O' :
|
case 'O' :
|
||||||
|
|
Loading…
Reference in New Issue