Re: cvs: php4 /ext/standard datetime.c

From: Date: Wed, 14 Jun 2000 17:59:51 +0000
Subject: Re: cvs: php4 /ext/standard datetime.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-265@lists.php.net to get a copy of this message
On Wed, 14 Jun 2000, Rasmus Lerdorf wrote: > > 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. > > Well, something like "abc" will be converted to 0 which is invalid for the > day and the month arguments. However, 0 is a valid year argument. Saying > that checkdate(12,12,'abc') is a valid date sucks. Saying my above example isn't valid sucks even more. Don't forget we get all of our CGI variables as strings. If you want to do it the hard & perfect way you need to check both IS_LONG and IS_STRING && is_numeric_string() and check for long. Is it worth it? If you think it is please do it or revert the patch which can break stuff now. Andi

« previous php.cvs (#265) next »