mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Revert [12485] as it breaks the functionality of is_serialized() and make more strings appear serialized. See #9930.
git-svn-id: http://svn.automattic.com/wordpress/trunk@12486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9189856169
commit
41dd7d25b7
@ -245,7 +245,29 @@ function maybe_unserialize( $original ) {
|
||||
* @return bool False if not serialized and true if it was.
|
||||
*/
|
||||
function is_serialized( $data ) {
|
||||
return is_string($data) && preg_match('/^(N;)|([aOs]:[0-9]+:.*[;}])|([bid]:[0-9.E+-]+;)$/s', $data);
|
||||
// if it isn't a string, it isn't serialized
|
||||
if ( !is_string( $data ) )
|
||||
return false;
|
||||
$data = trim( $data );
|
||||
if ( 'N;' == $data )
|
||||
return true;
|
||||
if ( !preg_match( '/^([adObis]):/', $data, $badions ) )
|
||||
return false;
|
||||
switch ( $badions[1] ) {
|
||||
case 'a' :
|
||||
case 'O' :
|
||||
case 's' :
|
||||
if ( preg_match( "/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data ) )
|
||||
return true;
|
||||
break;
|
||||
case 'b' :
|
||||
case 'i' :
|
||||
case 'd' :
|
||||
if ( preg_match( "/^{$badions[1]}:[0-9.E-]+;\$/", $data ) )
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user