tony2001                Thu Jun  7 08:58:38 2007 UTC

  Modified files:              
    /php-src/ext/ftp    ftp.c 
    /php-src/ext/session        session.c 
    /php-src/ext/standard       ftp_fopen_wrapper.c datetime.c 
    /php-src/ext/interbase      ibase_query.c 
  Log:
  php_gmtime_r() fixes
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/ftp.c?r1=1.123&r2=1.124&diff_format=u
Index: php-src/ext/ftp/ftp.c
diff -u php-src/ext/ftp/ftp.c:1.123 php-src/ext/ftp/ftp.c:1.124
--- php-src/ext/ftp/ftp.c:1.123 Mon Mar 26 08:02:36 2007
+++ php-src/ext/ftp/ftp.c       Thu Jun  7 08:58:38 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ftp.c,v 1.123 2007/03/26 08:02:36 tony2001 Exp $ */
+/* $Id: ftp.c,v 1.124 2007/06/07 08:58:38 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1012,6 +1012,9 @@
        /* figure out the GMT offset */
        stamp = time(NULL);
        gmt = php_gmtime_r(&stamp, &tmbuf);
+       if (!gmt) {
+               return -1;
+       }
        gmt->tm_isdst = -1;
 
        /* apply the GMT offset */
http://cvs.php.net/viewvc.cgi/php-src/ext/session/session.c?r1=1.470&r2=1.471&diff_format=u
Index: php-src/ext/session/session.c
diff -u php-src/ext/session/session.c:1.470 php-src/ext/session/session.c:1.471
--- php-src/ext/session/session.c:1.470 Wed May 16 01:32:28 2007
+++ php-src/ext/session/session.c       Thu Jun  7 08:58:38 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: session.c,v 1.470 2007/05/16 01:32:28 stas Exp $ */
+/* $Id: session.c,v 1.471 2007/06/07 08:58:38 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -930,11 +930,16 @@
 static inline void strcpy_gmt(char *ubuf, time_t *when)
 {
        char buf[MAX_STR];
-       struct tm tm;
+       struct tm tm, *res;
        int n;
        
-       php_gmtime_r(when, &tm);
+       res = php_gmtime_r(when, &tm);
        
+       if (!res) {
+               buf[0] = '\0';
+               return;
+       }
+
        n = snprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* 
SAFE */
                                week_days[tm.tm_wday], tm.tm_mday, 
                                month_names[tm.tm_mon], tm.tm_year + 1900, 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.93&r2=1.94&diff_format=u
Index: php-src/ext/standard/ftp_fopen_wrapper.c
diff -u php-src/ext/standard/ftp_fopen_wrapper.c:1.93 
php-src/ext/standard/ftp_fopen_wrapper.c:1.94
--- php-src/ext/standard/ftp_fopen_wrapper.c:1.93       Mon Apr 16 09:43:52 2007
+++ php-src/ext/standard/ftp_fopen_wrapper.c    Thu Jun  7 08:58:38 2007
@@ -18,7 +18,7 @@
    |          Sara Golemon <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
  */
-/* $Id: ftp_fopen_wrapper.c,v 1.93 2007/04/16 09:43:52 dmitry Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.94 2007/06/07 08:58:38 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -808,6 +808,9 @@
                /* figure out the GMT offset */
                stamp = time(NULL);
                gmt = php_gmtime_r(&stamp, &tmbuf);
+               if (!gmt) {
+                       goto mdtm_error;
+               }
                gmt->tm_isdst = -1;
 
                /* apply the GMT offset */
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/datetime.c?r1=1.144&r2=1.145&diff_format=u
Index: php-src/ext/standard/datetime.c
diff -u php-src/ext/standard/datetime.c:1.144 
php-src/ext/standard/datetime.c:1.145
--- php-src/ext/standard/datetime.c:1.144       Mon Jan  1 09:29:31 2007
+++ php-src/ext/standard/datetime.c     Thu Jun  7 08:58:38 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: datetime.c,v 1.144 2007/01/01 09:29:31 sebastian Exp $ */
+/* $Id: datetime.c,v 1.145 2007/06/07 08:58:38 tony2001 Exp $ */
 
 #include "php.h"
 #include "zend_operators.h"
@@ -58,6 +58,12 @@
 
        tm1 = php_gmtime_r(&t, &tmbuf);
        str = emalloc(81);
+       str[0] = '\0';
+
+       if (!tm1) {
+               return str;
+       }
+
        if (PG(y2k_compliance)) {
                snprintf(str, 80, "%s, %02d %s %04d %02d:%02d:%02d GMT",
                                day_short_names[tm1->tm_wday],
http://cvs.php.net/viewvc.cgi/php-src/ext/interbase/ibase_query.c?r1=1.32&r2=1.33&diff_format=u
Index: php-src/ext/interbase/ibase_query.c
diff -u php-src/ext/interbase/ibase_query.c:1.32 
php-src/ext/interbase/ibase_query.c:1.33
--- php-src/ext/interbase/ibase_query.c:1.32    Fri Mar 16 09:30:18 2007
+++ php-src/ext/interbase/ibase_query.c Thu Jun  7 08:58:38 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ibase_query.c,v 1.32 2007/03/16 09:30:18 tony2001 Exp $ */
+/* $Id: ibase_query.c,v 1.33 2007/06/07 08:58:38 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -675,7 +675,11 @@
                        case SQL_TYPE_DATE:
                        case SQL_TYPE_TIME:
                                if (Z_TYPE_P(b_var) == IS_LONG) {
-                                       php_gmtime_r(&Z_LVAL_P(b_var), &t);
+                                       struct tm *res;
+                                       res = php_gmtime_r(&Z_LVAL_P(b_var), 
&t);
+                                       if (!res) {
+                                               return FAILURE;
+                                       }
                                } else {
 #ifdef HAVE_STRPTIME
                                        char *format = 
INI_STR("ibase.timestampformat");

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to