From 918985616947825381d2006ac62ba1b9e726f8ea Mon Sep 17 00:00:00 2001 From: westi Date: Tue, 22 Dec 2009 13:10:06 +0000 Subject: [PATCH] Much improved is_serialized() which catches serialized doubles. Fixes #9930 props vladimir_kolesnikov and dd32. git-svn-id: http://svn.automattic.com/wordpress/trunk@12485 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 22b962c0fd..bc0b8ba906 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -245,29 +245,7 @@ function maybe_unserialize( $original ) { * @return bool False if not serialized and true if it was. */ function is_serialized( $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; + return is_string($data) && preg_match('/^(N;)|([aOs]:[0-9]+:.*[;}])|([bid]:[0-9.E+-]+;)$/s', $data); } /**