Created
June 3, 2013 16:22
-
-
Save waldoj/5699321 to your computer and use it in GitHub Desktop.
Actual code segment from ExpressionEngine, found within /expressionengine/expressionengine/libraries/Localize.php, in convert_human_date_to_gmt(). I tracked it down in an effort to fix the software's inability to store dates from prior to 1902 <http://ellislab.com/forums/viewthread/74033>, which they had blamed on everybody but themselves.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($year < 1902 OR $year > 2037) | |
{ | |
return $this->EE->lang->line('date_outside_of_range'); | |
} |
I think that's pretty easily addressed by PHP's PHP_INT_SIZE
constant, which exists for just this purpose:
if ( (PHP_INT_SIZE == 4) && ($year < 1902 OR $year > 2037) )
{
return $this->EE->lang->line('date_outside_of_range');
}
That way, only folks on 32-bit environments are bound to the range, while the rest of us can have proper dates.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nope, this is actually important, because otherwise dates outside that range will still be bound to the range. Now, mind you, the date issue is still their FAULT for using integers to store dates, but this piece of code isn't actually the culprit -- it's sensible error-handling given the limitations imposed by their other design decisions.