diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2003-09-15 00:07:51 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2003-09-15 00:07:51 +0000 |
commit | 67a070c151ad014de738f3f0e91d3ccece000196 (patch) | |
tree | e653bec284491676608a7bf9f42afae14cb9be55 /ext/standard/datetime.c | |
parent | 8254b8f49e80926f3ab0c5d099cb00b0c7ce90d5 (diff) | |
download | php-git-67a070c151ad014de738f3f0e91d3ccece000196.tar.gz |
Fixed bug #25530 (checkdate incorrectly handles floats)
Diffstat (limited to 'ext/standard/datetime.c')
-rw-r--r-- | ext/standard/datetime.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 52dd18e4e7..f9f7c2a9e6 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -917,37 +917,16 @@ char *php_std_date(time_t t TSRMLS_DC) Returns true(1) if it is a valid date in gregorian calendar */ PHP_FUNCTION(checkdate) { - pval **month, **day, **year; - int m, d, y, res=0; - - if (ZEND_NUM_ARGS() != 3 || - zend_get_parameters_ex(3, &month, &day, &year) == FAILURE) { - WRONG_PARAM_COUNT; - } + long m, d, y; - if (Z_TYPE_PP(year) == IS_STRING) { - res = is_numeric_string(Z_STRVAL_PP(year), Z_STRLEN_PP(year), NULL, NULL, 0); - if (res != IS_LONG && res != IS_DOUBLE) { - RETURN_FALSE; - } - } - convert_to_long_ex(day); - convert_to_long_ex(month); - convert_to_long_ex(year); - y = Z_LVAL_PP(year); - m = Z_LVAL_PP(month); - d = Z_LVAL_PP(day); - - if (y < 1 || y > 32767) { - RETURN_FALSE; - } - if (m < 1 || m > 12) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &m, &d, &y) == FAILURE) { RETURN_FALSE; } - if (d < 1 || d > phpday_tab[isleap(y)][m - 1]) { + + if (y < 1 || y > 32767 || m < 1 || m > 12 || d < 1 || d > phpday_tab[isleap(y)][m - 1]) { RETURN_FALSE; } - RETURN_TRUE; /* True : This month, day, year arguments are valid */ + RETURN_TRUE; /* True : This month, day, year arguments are valid */ } /* }}} */ |