diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index a2070c1ec7..b9320b2045 100644
|
|
|
function is_serialized( $data, $strict = true ) {
|
| 528 | 528 | case 'i': |
| 529 | 529 | case 'd': |
| 530 | 530 | $end = $strict ? '$' : ''; |
| 531 | | return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data ); |
| | 531 | return (bool) preg_match( "/^{$token}:[0-9.+E-]+;$end/", $data ); |
| 532 | 532 | } |
| 533 | 533 | return false; |
| 534 | 534 | } |
diff --git tests/phpunit/tests/functions.php tests/phpunit/tests/functions.php
index 53f6e2cd5c..50bf9305de 100644
|
|
|
class Tests_Functions extends WP_UnitTestCase {
|
| 213 | 213 | '3', |
| 214 | 214 | 4, |
| 215 | 215 | ) |
| 216 | | ), |
| | 216 | ) |
| 217 | 217 | ); |
| 218 | 218 | foreach ( $cases as $case ) { |
| 219 | 219 | $this->assertTrue( is_serialized( $case ), "Serialized data: $case" ); |
| … |
… |
class Tests_Functions extends WP_UnitTestCase {
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| | 232 | /** |
| | 233 | * @ticket 46570 |
| | 234 | */ |
| | 235 | function test_is_serialized_should_return_true_for_large_digits() { |
| | 236 | |
| | 237 | $cases = array( |
| | 238 | serialize( 1.7976931348623157E+308 ), |
| | 239 | serialize( array( 1.7976931348623157E+308, 1.23e50 ) ) |
| | 240 | ); |
| | 241 | |
| | 242 | foreach( $cases as $case ) { |
| | 243 | |
| | 244 | $this->assertTrue( is_serialized( $case ), "Serialized data: $case" ); |
| | 245 | |
| | 246 | } |
| | 247 | |
| | 248 | } |
| | 249 | |
| 232 | 250 | /** |
| 233 | 251 | * @ticket 17375 |
| 234 | 252 | */ |