mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-03 11:31:39 +00:00
General: Correctly detect large floats in is_serialized().
Props killerbishop, donmhico, hoythan. Fixes #46570. git-svn-id: https://develop.svn.wordpress.org/trunk@45754 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -528,7 +528,7 @@ function is_serialized( $data, $strict = true ) {
|
|||||||
case 'i':
|
case 'i':
|
||||||
case 'd':
|
case 'd':
|
||||||
$end = $strict ? '$' : '';
|
$end = $strict ? '$' : '';
|
||||||
return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data );
|
return (bool) preg_match( "/^{$token}:[0-9.E+-]+;$end/", $data );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,6 +229,20 @@ class Tests_Functions extends WP_UnitTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ticket 46570
|
||||||
|
*/
|
||||||
|
function test_is_serialized_should_return_true_for_large_floats() {
|
||||||
|
$cases = array(
|
||||||
|
serialize( 1.7976931348623157E+308 ),
|
||||||
|
serialize( array( 1.7976931348623157E+308, 1.23e50 ) )
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $cases as $case ) {
|
||||||
|
$this->assertTrue( is_serialized( $case ), "Serialized data: $case" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ticket 17375
|
* @ticket 17375
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user