Changeset 16300 for trunk/wp-includes/functions.php
- Timestamp:
- 11/11/2010 04:10:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r16215 r16300 247 247 function is_serialized( $data ) { 248 248 // if it isn't a string, it isn't serialized 249 if ( ! is_string( $data ) )249 if ( ! is_string( $data ) ) 250 250 return false; 251 251 $data = trim( $data ); 252 252 if ( 'N;' == $data ) 253 253 return true; 254 if ( function_exists('strpbrk') ) { 255 if ( strlen($data) > 1 && strpbrk($data,'adObis') == $data && $data[1] == ':' ) { 256 $badions = array(); 257 $badions[1] = $data[0]; 258 } else { 259 return false; 260 } 261 } elseif ( !preg_match( '/^([adObis]):/', $data, $badions ) ) { 254 $length = strlen( $data ); 255 if ( $length < 4 ) 262 256 return false; 263 } 264 switch ( $badions[1] ) { 257 if ( ':' !== $data[1] ) 258 return false; 259 $lastc = $data[$length-1]; 260 if ( ';' !== $lastc && '}' !== $lastc ) 261 return false; 262 $token = $data[0]; 263 switch ( $token ) { 264 case 's' : 265 if ( '"' !== $data[$length-2] ) 266 return false; 265 267 case 'a' : 266 268 case 'O' : 267 case 's' : 268 if ( preg_match( "/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data ) ) 269 return true; 270 break; 269 return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data ); 271 270 case 'b' : 272 271 case 'i' : 273 272 case 'd' : 274 if ( preg_match( "/^{$badions[1]}:[0-9.E-]+;\$/", $data ) ) 275 return true; 276 break; 273 return (bool) preg_match( "/^{$token}:[0-9.E-]+;\$/", $data ); 277 274 } 278 275 return false;
Note: See TracChangeset
for help on using the changeset viewer.