}
ta = php_localtime_r(&t, &tmbuf);
+ if (!ta) {
+ RETURN_FALSE;
+ }
+
jdate = GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1, ta->tm_mday);
RETURN_LONG(jdate);
{
struct tm *ta, tmbuf;
time_t the_time;
- char *tzid;
+ char *tzid = NULL;
the_time = time(NULL);
ta = php_localtime_r(&the_time, &tmbuf);
- tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
+ if (ta) {
+ tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
+ }
if (! tzid) {
tzid = "UTC";
}
- php_error_docref(NULL TSRMLS_CC, E_STRICT, DATE_TZ_ERRMSG "We selected '%s' for '%s/%.1f/%s' instead", tzid, ta->tm_zone, (float) (ta->tm_gmtoff / 3600), ta->tm_isdst ? "DST" : "no DST");
+ php_error_docref(NULL TSRMLS_CC, E_STRICT, DATE_TZ_ERRMSG "We selected '%s' for '%s/%.1f/%s' instead", tzid, ta ? ta->tm_zone : "Unknown", ta ? (float) (ta->tm_gmtoff / 3600) : 0, ta ? (ta->tm_isdst ? "DST" : "no DST") : "Unknown");
return tzid;
}
#endif
{
char ctimebuf[52];
pp = php_ctime_r((time_t *) &p->l, ctimebuf);
+ if (!pp) {
+ return;
+ }
if ((rt = strchr(pp, '\n')) != NULL) {
*rt = '\0';
}
time(&curtime);
ta = php_localtime_r(&curtime, &tmbuf);
datetime_str = php_asctime_r(ta, asctimebuf);
- datetime_str[strlen(datetime_str)-1]=0; /* get rid of the trailing newline */
- snprintf(memory_leak_buf, sizeof(memory_leak_buf), "[%s] Script: '%s'\n", datetime_str, SAFE_FILENAME(SG(request_info).path_translated));
+ if (datetime_str) {
+ datetime_str[strlen(datetime_str)-1]=0; /* get rid of the trailing newline */
+ snprintf(memory_leak_buf, sizeof(memory_leak_buf), "[%s] Script: '%s'\n", datetime_str, SAFE_FILENAME(SG(request_info).path_translated));
+ } else {
+ snprintf(memory_leak_buf, sizeof(memory_leak_buf), "[null] Script: '%s'\n", SAFE_FILENAME(SG(request_info).path_translated));
+ }
# if defined(PHP_WIN32)
OutputDebugString(memory_leak_buf);
# else