tony2001                Thu Jun  7 08:59:00 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /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:
  MFH: php_gmtime_r() fixes
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/ftp.c?r1=1.112.2.4.2.8&r2=1.112.2.4.2.9&diff_format=u
Index: php-src/ext/ftp/ftp.c
diff -u php-src/ext/ftp/ftp.c:1.112.2.4.2.8 php-src/ext/ftp/ftp.c:1.112.2.4.2.9
--- php-src/ext/ftp/ftp.c:1.112.2.4.2.8 Sat Mar 24 16:25:42 2007
+++ php-src/ext/ftp/ftp.c       Thu Jun  7 08:59:00 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ftp.c,v 1.112.2.4.2.8 2007/03/24 16:25:42 iliaa Exp $ */
+/* $Id: ftp.c,v 1.112.2.4.2.9 2007/06/07 08:59:00 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.417.2.8.2.34&r2=1.417.2.8.2.35&diff_format=u
Index: php-src/ext/session/session.c
diff -u php-src/ext/session/session.c:1.417.2.8.2.34 
php-src/ext/session/session.c:1.417.2.8.2.35
--- php-src/ext/session/session.c:1.417.2.8.2.34        Wed May 16 01:18:14 2007
+++ php-src/ext/session/session.c       Thu Jun  7 08:59:00 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: session.c,v 1.417.2.8.2.34 2007/05/16 01:18:14 stas Exp $ */
+/* $Id: session.c,v 1.417.2.8.2.35 2007/06/07 08:59:00 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -946,10 +946,15 @@
 static 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 = slprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* 
SAFE */
                                week_days[tm.tm_wday], tm.tm_mday, 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.85.2.4.2.1&r2=1.85.2.4.2.2&diff_format=u
Index: php-src/ext/standard/ftp_fopen_wrapper.c
diff -u php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.1 
php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.2
--- php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.1       Mon Jan  1 
09:36:08 2007
+++ php-src/ext/standard/ftp_fopen_wrapper.c    Thu Jun  7 08:59:00 2007
@@ -18,7 +18,7 @@
    |          Sara Golemon <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
  */
-/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.1 2007/01/01 09:36:08 sebastian Exp $ 
*/
+/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.2 2007/06/07 08:59:00 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.134.2.2.2.3&r2=1.134.2.2.2.4&diff_format=u
Index: php-src/ext/standard/datetime.c
diff -u php-src/ext/standard/datetime.c:1.134.2.2.2.3 
php-src/ext/standard/datetime.c:1.134.2.2.2.4
--- php-src/ext/standard/datetime.c:1.134.2.2.2.3       Mon Jan  1 09:36:08 2007
+++ php-src/ext/standard/datetime.c     Thu Jun  7 08:59:00 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: datetime.c,v 1.134.2.2.2.3 2007/01/01 09:36:08 sebastian Exp $ */
+/* $Id: datetime.c,v 1.134.2.2.2.4 2007/06/07 08:59:00 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.23.2.1.2.9&r2=1.23.2.1.2.10&diff_format=u
Index: php-src/ext/interbase/ibase_query.c
diff -u php-src/ext/interbase/ibase_query.c:1.23.2.1.2.9 
php-src/ext/interbase/ibase_query.c:1.23.2.1.2.10
--- php-src/ext/interbase/ibase_query.c:1.23.2.1.2.9    Thu Mar 15 22:33:04 2007
+++ php-src/ext/interbase/ibase_query.c Thu Jun  7 08:59:00 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ibase_query.c,v 1.23.2.1.2.9 2007/03/15 22:33:04 tony2001 Exp $ */
+/* $Id: ibase_query.c,v 1.23.2.1.2.10 2007/06/07 08:59:00 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -674,7 +674,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