[wp-trac] [WordPress Trac] #9930: is_serialized() returns false on serialized doubles
WordPress Trac
wp-trac at lists.automattic.com
Wed Nov 17 15:47:07 UTC 2010
#9930: is_serialized() returns false on serialized doubles
---------------------------------+------------------------------------------
Reporter: vladimir_kolesnikov | Owner: westi
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Future Release
Component: General | Version:
Severity: minor | Resolution:
Keywords: needs-refresh |
---------------------------------+------------------------------------------
Comment(by hakre):
If someone is looking for a regex that is validating a whole float/double
value, this one is pretty strict so far:
{{{(d:(?:[-]?INF|[+-]?(?:(?:[0-9]+|(?:[0-9]*[\.][0-9]+)|(?:[0-9]+[\.][0-9]*))|(?:[0-9]+|(?:([0-9]*[\.][0-9]+)|(?:[0-9]+[\.][0-9]*)))[eE][+-]?[0-9]+));)}}}
It takes care not only of the scientific notations but as well for INF and
-INF. If you need to get a float to be serialized for a tests with INF,
this did work for me without caring about a systems float size:
{{{
$float = INF; // or -INF
$serialized = serialize($float);
}}}
For this ticket's traction I think it now depends on whether or not this
should be fixed as it might imply performance issues. But the actual
performance should be tested before making assumptions as my impression
is, that PHP is pretty fast with regular expression when it calls for the
same multiple times per request. This is the case for the is_serialized
function.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9930#comment:35>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list