cvs: php4 /ext/standard datetime.c
| From: | Rasmus Lerdorf | Date: | Wed, 14 Jun 2000 20:31:31 +0000 |
| Subject: | cvs: php4 /ext/standard datetime.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-270@lists.php.net to get a copy of this message | ||
rasmus Wed Jun 14 13:31:31 2000 EDT
Modified files:
/php4/ext/standard datetime.c
Log:
Refine checkdate() fix to accept numeric strings and floating point as well
Index: php4/ext/standard/datetime.c
diff -u php4/ext/standard/datetime.c:1.44 php4/ext/standard/datetime.c:1.45
--- php4/ext/standard/datetime.c:1.44 Wed Jun 14 09:35:48 2000
+++ php4/ext/standard/datetime.c Wed Jun 14 13:31:31 2000
@@ -19,7 +19,7 @@
*/
-/* $Id: datetime.c,v 1.44 2000/06/14 16:35:48 rasmus Exp $ */
+/* $Id: datetime.c,v 1.45 2000/06/14 20:31:31 rasmus Exp $ */
#include "php.h"
@@ -595,14 +595,18 @@
PHP_FUNCTION(checkdate)
{
pval **month, **day, **year;
- int m, d, y;
+ int m, d, y, res=0;
if (ZEND_NUM_ARGS() != 3 ||
zend_get_parameters_ex(3, &month, &day, &year) == FAILURE) {
WRONG_PARAM_COUNT;
}
- if((*year)->type != IS_LONG) {
- RETURN_FALSE;
+
+ if((*year)->type == IS_STRING) {
+ res = is_numeric_string((*year)->value.str.val, (*year)->value.str.len, NULL, NULL);
+ if(res!=IS_LONG && res !=IS_DOUBLE) {
+ RETURN_FALSE;
+ }
}
convert_to_long_ex(day);
convert_to_long_ex(month);