]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #25530 (checkdate incorrectly handles floats)
authorIlia Alshanetsky <iliaa@php.net>
Mon, 15 Sep 2003 00:08:05 +0000 (00:08 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 15 Sep 2003 00:08:05 +0000 (00:08 +0000)
NEWS
ext/standard/datetime.c

diff --git a/NEWS b/NEWS
index c73958454a817eb67cbc27f903b7687cc3d8f22e..4226dcbe79e571fc31ce8e19af4d4d01cc061c1f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,9 +4,10 @@ PHP 4                                                                      NEWS
 - Made MCVE extension available on win32. (Jani)
 - Added apache_get_version() function. (Ilia)
 - Fixed disk_total_space() and disk_free_space() under FreeBSD. (Jon Parise)
-- Fixed crash bug when non-existing save/serializer handler was used. (Jani)
+[B- Fixed crash bug when non-existing save/serializer handler was used. (Jani)
 - Fixed memory leak in gethostbynamel() if an error occurs. (Sara)
 - Fixed FastCGI being unable to bind to a specific IP. (Sascha)
+- Fixed bug #25530 (checkdate incorrectly handles floats). (Ilia)
 - Fixed bug #25525 (ldap_explode_dn() crashes when passed invalid dn).
   (Sara, patch by: mikael dot suvi at trigger dot ee)
 - Fixed bug #25504 (pcre_match_all() crashes when passed only 2 parameters).
index 1c14aa36995cf4bf6980f4c41ef2aeddc9078f68..75e42670d26e587aaeacf2e1812145195af82cd7 100644 (file)
@@ -782,37 +782,16 @@ char *php_std_date(time_t t)
    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 */
 }
 /* }}} */