/* Default to the current year if year parameter is not given */
{
time_t a;
- struct tm b;
+ struct tm b, *res;
time(&a);
- php_localtime_r(&a, &b);
- year = 1900 + b.tm_year;
+ res = php_localtime_r(&a, &b);
+ if (!res) {
+ year = 1900;
+ } else {
+ year = 1900 + b.tm_year;
+ }
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
computeJD(&x);
t = (x.rJD-2440587.5)*86400.0 + 0.5;
sqlite3OsEnterMutex();
- pTm = php_localtime_r
-(&t, &tmbuf);
+ pTm = php_localtime_r(&t, &tmbuf);
+ if (!pTm) {
+ return 0;
+ }
y.Y = pTm->tm_year + 1900;
y.M = pTm->tm_mon + 1;
y.D = pTm->tm_mday;
t = (x.rJD-2440587.5)*86400.0 + 0.5;
sqliteOsEnterMutex();
pTm = php_localtime_r(&t, &tmbuf);
+ if (!pTm) {
+ return 0;
+ }
y.Y = pTm->tm_year + 1900;
y.M = pTm->tm_mon + 1;
y.D = pTm->tm_mday;
the_time = time(NULL);
ta = php_localtime_r(&the_time, &tmbuf);
- if ((ta->tm_mon==3) && (ta->tm_mday==1)) {
+ if (ta && (ta->tm_mon==3) && (ta->tm_mday==1)) {
logo_guid = PHP_EGG_LOGO_GUID;
} else {
logo_guid = PHP_LOGO_GUID;
* 9/1999 - 10/2000
* HISTORY
* $Log$
+ * Revision 1.10 2007/01/01 09:29:33 sebastian
+ * Bump year.
+ *
* Revision 1.9 2007/11/30 16:38:53 iliaa
* zts fixes
*
static int date_to_ISO8601 (time_t value, char *buf, int length) {
struct tm *tm, tmbuf;
tm = php_localtime_r(&value, &tmbuf);
+ if (!tm) {
+ return 0;
+ }
#if 0 /* TODO: soap seems to favor this method. xmlrpc the latter. */
return strftime (buf, length, "%Y-%m-%dT%H:%M:%SZ", tm);
#else