iliaa Sun Sep 14 20:07:59 2003 EDT
Modified files:
/php-src/ext/standard datetime.c
Log:
Fixed bug #25530 (checkdate incorrectly handles floats)
Index: php-src/ext/standard/datetime.c
diff -u php-src/ext/standard/datetime.c:1.110 php-src/ext/standard/datetime.c:1.111
--- php-src/ext/standard/datetime.c:1.110 Tue Jun 10 16:03:37 2003
+++ php-src/ext/standard/datetime.c Sun Sep 14 20:07:51 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: datetime.c,v 1.110 2003/06/10 20:03:37 imajes Exp $ */
+/* $Id: datetime.c,v 1.111 2003/09/15 00:07:51 iliaa Exp $ */
#include "php.h"
#include "zend_operators.h"
@@ -917,37 +917,16 @@
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 */
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php