cvs: php4 /ext/com conversion.c
| From: | Harald Radi | Date: | Mon, 20 Aug 2001 08:53:17 +0000 |
| Subject: | cvs: php4 /ext/com conversion.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6967@lists.php.net to get a copy of this message | ||
phanto Mon Aug 20 04:53:17 2001 EDT
Modified files:
/php4/ext/com conversion.c
Log:
catch date conversion errors
Index: php4/ext/com/conversion.c
diff -u php4/ext/com/conversion.c:1.34 php4/ext/com/conversion.c:1.35
--- php4/ext/com/conversion.c:1.34 Fri Aug 17 04:17:12 2001
+++ php4/ext/com/conversion.c Mon Aug 20 04:53:17 2001
@@ -614,27 +614,32 @@
break;
case VT_DATE: {
+ BOOL success;
SYSTEMTIME wintime;
struct tm phptime;
if (V_ISBYREF(var_arg)) {
- VariantTimeToSystemTime(*V_DATEREF(var_arg), &wintime);
+ success = VariantTimeToSystemTime(*V_DATEREF(var_arg), &wintime);
} else {
- VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
+ success = VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
}
- memset(&phptime, 0, sizeof(phptime));
+ if (success) {
+ memset(&phptime, 0, sizeof(phptime));
- phptime.tm_year = wintime.wYear - 1900;
- phptime.tm_mon = wintime.wMonth - 1;
- phptime.tm_mday = wintime.wDay;
- phptime.tm_hour = wintime.wHour;
- phptime.tm_min = wintime.wMinute;
- phptime.tm_sec = wintime.wSecond;
- phptime.tm_isdst = -1;
+ phptime.tm_year = wintime.wYear - 1900;
+ phptime.tm_mon = wintime.wMonth - 1;
+ phptime.tm_mday = wintime.wDay;
+ phptime.tm_hour = wintime.wHour;
+ phptime.tm_min = wintime.wMinute;
+ phptime.tm_sec = wintime.wSecond;
+ phptime.tm_isdst = -1;
- tzset();
- ZVAL_LONG(pval_arg, mktime(&phptime));
+ tzset();
+ ZVAL_LONG(pval_arg, mktime(&phptime));
+ } else {
+ ret = FAILURE;
+ }
}
break;