]> granicus.if.org Git - php/commitdiff
MFH: php_localtime_r() checks
authorAntony Dovgal <tony2001@php.net>
Thu, 7 Jun 2007 09:07:36 +0000 (09:07 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 7 Jun 2007 09:07:36 +0000 (09:07 +0000)
ext/calendar/easter.c
ext/pdo_sqlite/sqlite/src/date.c
ext/sqlite/libsqlite/src/date.c
ext/standard/info.c
ext/xmlrpc/libxmlrpc/xmlrpc.c

index 6329986e4ab8ecc86ad33eb1794d300c9c681408..ed28931ae0bab205c0baf832ed664990d717a38d 100644 (file)
@@ -36,10 +36,14 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
        /* 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,
index a5446e128e3a54c2f4b0b539b948650e8e72f8b4..2dcab695337b3c8e301b26f8ab07095159584944 100644 (file)
@@ -417,6 +417,9 @@ static double localtimeOffset(DateTime *p){
   t = (x.rJD-2440587.5)*86400.0 + 0.5;
   sqlite3OsEnterMutex();
   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;
index 9fb075d43ec7311224b3c33487f7482c257450ed..cd6761b66a535ca8eb68e0b3b0498eea3a8cc5fb 100644 (file)
@@ -420,6 +420,9 @@ static double localtimeOffset(DateTime *p){
   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;
index a3b349177d5d1e1a28545628427800c0dc7dc178..eb587366a0e212dcc213da50115755270435bc53 100644 (file)
@@ -1066,7 +1066,7 @@ PHPAPI char *php_logo_guid()
        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;
index 2a5600290b43aba75130e669b0c6d63ee904c181..d263ab68780c0bc621fc98c576ff831a578b3843 100644 (file)
@@ -43,6 +43,9 @@ static const char rcsid[] = "#(@) $Id$";
  *   9/1999 - 10/2000
  * HISTORY
  *   $Log$
+ *   Revision 1.8.4.1  2006/11/30 16:38:37  iliaa
+ *   last set of zts fixes
+ *
  *   Revision 1.8  2005/03/28 00:07:24  edink
  *   Reshufle includes to make it compile on windows
  *
@@ -233,6 +236,9 @@ static int date_from_ISO8601 (const char *text, time_t * value) {
 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