Re: cvs: php4 /ext/standard datetime.c
| From: | Andi Gutmans | Date: | Wed, 14 Jun 2000 16:45:29 +0000 |
| Subject: | Re: cvs: php4 /ext/standard datetime.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-258@lists.php.net to get a copy of this message | ||
I don't quite understand this fix.
Why only require the year to be a long and not month & day.
Also think of checkdate("12","12","12");
Why shouldn't this work?
What is wrong with just using convert_to_long_ex() for all three?
If the user sends junk then like the rest of PHP it will convert it to a
number and he'll get a wrong result; or bad input should be handled in a
more consistent way.
Andi
On Wed, 14 Jun 2000, Rasmus Lerdorf wrote:
> rasmus Wed Jun 14 09:35:48 2000 EDT
>
> Modified files:
> /php4/ext/standard datetime.c
> Log:
> Require the year arg to checkdate to be an integer - fix for bug #5034
> @Require the year arg to checkdate to be an integer (Rasmus)
>
>
> Index: php4/ext/standard/datetime.c
> diff -u php4/ext/standard/datetime.c:1.43 php4/ext/standard/datetime.c:1.44
> --- php4/ext/standard/datetime.c:1.43 Fri Jun 9 13:18:36 2000
> +++ php4/ext/standard/datetime.c Wed Jun 14 09:35:48 2000
> @@ -19,7 +19,7 @@
> */
>
>
> -/* $Id: datetime.c,v 1.43 2000/06/09 20:18:36 andrei Exp $ */
> +/* $Id: datetime.c,v 1.44 2000/06/14 16:35:48 rasmus Exp $ */
>
>
> #include "php.h"
> @@ -600,6 +600,9 @@
> if (ZEND_NUM_ARGS() != 3 ||
> zend_get_parameters_ex(3, &month, &day, &year) == FAILURE) {
> WRONG_PARAM_COUNT;
> + }
> + if((*year)->type != IS_LONG) {
> + RETURN_FALSE;
> }
> convert_to_long_ex(day);
> convert_to_long_ex(month);
>
>
>
>