iliaa Sun Sep 14 20:08:10 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src NEWS
/php-src/ext/standard datetime.c
Log:
MFH: Fixed bug #25530 (checkdate incorrectly handles floats)
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.395 php-src/NEWS:1.1247.2.396
--- php-src/NEWS:1.1247.2.395 Sat Sep 13 13:31:25 2003
+++ php-src/NEWS Sun Sep 14 20:08:03 2003
@@ -4,9 +4,10 @@
- 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: php-src/ext/standard/datetime.c
diff -u php-src/ext/standard/datetime.c:1.96.2.8
php-src/ext/standard/datetime.c:1.96.2.9
--- php-src/ext/standard/datetime.c:1.96.2.8 Sun May 4 07:22:00 2003
+++ php-src/ext/standard/datetime.c Sun Sep 14 20:08:05 2003
@@ -19,7 +19,7 @@
*/
-/* $Id: datetime.c,v 1.96.2.8 2003/05/04 11:22:00 moriyoshi Exp $ */
+/* $Id: datetime.c,v 1.96.2.9 2003/09/15 00:08:05 iliaa Exp $ */
#include "php.h"
@@ -782,37 +782,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