248 | | // if it isn't a string, it isn't serialized |
249 | | if ( !is_string( $data ) ) |
250 | | return false; |
251 | | $data = trim( $data ); |
252 | | if ( 'N;' == $data ) |
253 | | return true; |
254 | | if ( !preg_match( '/^([adObis]):/', $data, $badions ) ) |
255 | | return false; |
256 | | switch ( $badions[1] ) { |
257 | | case 'a' : |
258 | | case 'O' : |
259 | | case 's' : |
260 | | if ( preg_match( "/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data ) ) |
261 | | return true; |
262 | | break; |
263 | | case 'b' : |
264 | | case 'i' : |
265 | | case 'd' : |
266 | | if ( preg_match( "/^{$badions[1]}:[0-9.E-]+;\$/", $data ) ) |
267 | | return true; |
268 | | break; |
269 | | } |
270 | | return false; |
| 248 | return is_string($data) && preg_match('/^(N;)|([aOs]:[0-9]+:.*[;}])|([bid]:[0-9.E+-]+;)$/', $data); |