Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> PHP still fails

It still fails to reject February 31, I'm completely not surprised to hear that it fails on IPv6.



I don't know which specific function you're talking about, but there may be a good reason for it.


Both strtotime() - PHP's "take a string and do your damnedest to make a date out of it" function - and DateTime.parseFromFormat() - the more restrictive TZ-aware class - accept it and give you March 2/3. There's a separate validate_date() or something like that that actually rejects Feb 31.


I'm not sure that's entirely wrong, just a different attitude than you might expect. Also, for that matter, I think MySQL accepts, will store, and will retrieve Feb 31 IIRC. Why? It's liberal in the correctness of input.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: