You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed recently that the function Valid::date has stopped working for timestamp.
/** * Tests if a string is a valid date string. * * @param string $str date to check * @return boolean */publicstaticfunctiondate($str)
{
return (strtotime($str) !== FALSE);
}
It's not recognising it as a timestamp, but as a time followed by a partial date. The 1499385600 fails because 14:99 isn't a valid time.
So, even if Valid::date accepted timestamps reliably, it wouldn't be safe to handle them in your application unless you knew that's what they were and treated them differently to a date string.
If you actually want to accept only timestamps then I'd suggest validating as an integer within a suitable range, and explicitly treating as a timestamp in your application code.
If you want to accept date strings, then potentially it's better to use a custom date validator that's more restrictive about the formats it accepts.
I noticed recently that the function Valid::date has stopped working for timestamp.
Example:
The text was updated successfully, but these errors were encountered: