]> granicus.if.org Git - php/commitdiff
Fixed wrong result of cal_days_in_month() with bad dates
authorDmitry Stogov <dmitry@php.net>
Thu, 7 Apr 2005 16:12:27 +0000 (16:12 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 7 Apr 2005 16:12:27 +0000 (16:12 +0000)
ext/calendar/calendar.c

index acf0d843c9e067d7a7be4129ecb7112545aded99..a8a4eb5262a1b0e58ab85920318434cb40666396 100644 (file)
@@ -246,6 +246,11 @@ PHP_FUNCTION(cal_days_in_month)
 
        sdn_start = calendar->to_jd(year, month, 1);
 
+       if (sdn_start == 0) {
+        php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid date.");
+        RETURN_FALSE;
+       }
+
        sdn_next = calendar->to_jd(year, 1 + month, 1);
 
        if (sdn_next == 0) {