Ticket #14429: 14429.10.diff
File 14429.10.diff, 1.5 KB (added by , 9 years ago) |
---|
-
wp-includes/functions.php
229 229 */ 230 230 function is_serialized( $data ) { 231 231 // if it isn't a string, it isn't serialized 232 if ( ! is_string( $data ) )232 if ( ! is_string( $data ) ) 233 233 return false; 234 234 $data = trim( $data ); 235 235 if ( 'N;' == $data ) 236 236 return true; 237 if ( function_exists('strpbrk') ) { 238 if ( strlen($data) > 1 && strpbrk($data,'adObis') == $data && $data[1] == ':' ) { 239 $badions = array(); 240 $badions[1] = $data[0]; 241 } else { 242 return false; 243 } 244 } elseif ( !preg_match( '/^([adObis]):/', $data, $badions ) ) { 237 $length = strlen( $data ); 238 if ( $length < 4 ) 245 239 return false; 246 } 247 switch ( $badions[1] ) { 240 if ( ':' !== $data[1] ) 241 return false; 242 $lastc = $data[$length-1]; 243 if ( ';' !== $lastc && '}' !== $lastc ) 244 return false; 245 $token = $data[0]; 246 switch ( $token ) { 247 case 's' : 248 if ( '"' !== $data[$length-2] ) 249 return false; 248 250 case 'a' : 249 251 case 'O' : 250 case 's' : 251 if ( preg_match( "/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data ) ) 252 return true; 253 break; 252 return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data ); 254 253 case 'b' : 255 254 case 'i' : 256 255 case 'd' : 257 if ( preg_match( "/^{$badions[1]}:[0-9.E-]+;\$/", $data ) ) 258 return true; 259 break; 256 return (bool) preg_match( "/^{$token}:[0-9.E-]+;\$/", $data ); 260 257 } 261 258 return false; 262 259 }