cvs: php4 /ext/standard datetime.c
| From: | Hartmut Holzgraefe | Date: | Tue, 01 Aug 2000 11:16:21 +0000 |
| Subject: | cvs: php4 /ext/standard datetime.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1007@lists.php.net to get a copy of this message | ||
hholzgra Tue Aug 1 04:16:21 2000 EDT
Modified files:
/php4/ext/standard datetime.c
Log:
protect datetime() against all zero inputs ...
Index: php4/ext/standard/datetime.c
diff -u php4/ext/standard/datetime.c:1.51 php4/ext/standard/datetime.c:1.52
--- php4/ext/standard/datetime.c:1.51 Thu Jul 13 18:08:59 2000
+++ php4/ext/standard/datetime.c Tue Aug 1 04:16:20 2000
@@ -19,7 +19,7 @@
*/
-/* $Id: datetime.c,v 1.51 2000/07/14 01:08:59 rasmus Exp $ */
+/* $Id: datetime.c,v 1.52 2000/08/01 11:16:20 hholzgra Exp $ */
#include "php.h"
@@ -120,6 +120,17 @@
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)