From: Hartmut Holzgraefe Date: Tue, 1 Aug 2000 11:16:20 +0000 (+0000) Subject: protect datetime() against all zero inputs ... X-Git-Tag: PRE_FILE_COMPILE_API_CHANGE~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f194a3a25d5293b8b21d54b2259c4b33cd7cce4a;p=php protect datetime() against all zero inputs ... --- diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 2c4622ac0b..61416c0dd6 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -120,6 +120,17 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm) ta->tm_isdst = is_dst = (*arguments[6])->value.lval; /* fall-through */ case 6: + /* special case: + a zero in year, month and day is considered illegal + as it would be interpreted as 30.11.1999 otherwise + */ + if ( ( (*arguments[5])->value.lval==0) + &&((*arguments[4])->value.lval==0) + &&((*arguments[3])->value.lval==0) + ) { + RETURN_LONG(-1); + } + /* ** Accept parameter in range 0..1000 interpreted as 1900..2900 ** (if 100 is given, it means year 2000)