Hi!

Bug #48247 appears to be not entirely fixed still, it still produces a torrent of warnings in certain configs (namely, take php.ini-production and edit it to enable error_log, don't touch anything else - I get 400K worth of warnings). Attached patch should fix it. Please tell if there's some objection to it, otherwise I'll commit it tomorrow.
--
Stanislav Malyshev, Zend Software Architect
s...@zend.com   http://www.zend.com/
(408)253-8829   MSN: s...@zend.com
? date.diff
Index: php_date.c
===================================================================
RCS file: /repository/php-src/ext/date/php_date.c,v
retrieving revision 1.43.2.45.2.51.2.78
diff -u -r1.43.2.45.2.51.2.78 php_date.c
--- php_date.c  31 May 2009 21:28:38 -0000      1.43.2.45.2.51.2.78
+++ php_date.c  11 Jun 2009 17:58:26 -0000
@@ -591,6 +591,7 @@
        date_globals->default_timezone = NULL;
        date_globals->timezone = NULL;
        date_globals->tzcache = NULL;
+       date_globals->guessing_tz = 0;
 }
 /* }}} */
 
@@ -610,6 +611,7 @@
        }
        DATEG(timezone) = NULL;
        DATEG(tzcache) = NULL;
+       DATEG(guessing_tz) = 0;
 
        return SUCCESS;
 }
@@ -858,8 +860,11 @@
                if (! tzid) {
                        tzid = "UTC";
                }
-               
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, 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");
+               if(DATEG(guessing_tz) < 1) {
+                       DATEG(guessing_tz) = 1;
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, 
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");
+                       DATEG(guessing_tz) = 0;
+               }
                return tzid;
        }
 #endif
@@ -878,7 +883,11 @@
                                if (! tzid) {
                                        tzid = "UTC";
                                }
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
DATE_TZ_ERRMSG "We selected '%s' for '%.1f/no DST' instead", tzid, ((tzi.Bias + 
tzi.StandardBias) / -60.0));
+                               if(DATEG(guessing_tz) < 1) {
+                                       DATEG(guessing_tz) = 1;
+                                       php_error_docref(NULL TSRMLS_CC, 
E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/no DST' instead", tzid, 
((tzi.Bias + tzi.StandardBias) / -60.0));
+                                       DATEG(guessing_tz) = 0;
+                               }
                                break;
 
                        /* DST in effect */
@@ -892,7 +901,11 @@
                                if (! tzid) {
                                        tzid = "UTC";
                                }
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
DATE_TZ_ERRMSG "We selected '%s' for '%.1f/DST' instead", tzid, ((tzi.Bias + 
tzi.DaylightBias) / -60.0));
+                               if(DATEG(guessing_tz) < 1) {
+                                       DATEG(guessing_tz) = 1;
+                                       php_error_docref(NULL TSRMLS_CC, 
E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/DST' instead", tzid, 
((tzi.Bias + tzi.DaylightBias) / -60.0));
+                                       DATEG(guessing_tz) = 0;
+                               }
                                break;
                }
                return tzid;
@@ -907,7 +920,11 @@
        }
 #endif
        /* Fallback to UTC */
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We had to 
select 'UTC' because your platform doesn't provide functionality for the 
guessing algorithm");
+       if(DATEG(guessing_tz) < 1) {
+               DATEG(guessing_tz) = 1;
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We 
had to select 'UTC' because your platform doesn't provide functionality for the 
guessing algorithm");
+               DATEG(guessing_tz) = 0;
+       }
        return "UTC";
 }
 
Index: php_date.h
===================================================================
RCS file: /repository/php-src/ext/date/php_date.h,v
retrieving revision 1.17.2.11.2.3.2.13
diff -u -r1.17.2.11.2.3.2.13 php_date.h
--- php_date.h  31 May 2009 21:28:38 -0000      1.17.2.11.2.3.2.13
+++ php_date.h  11 Jun 2009 17:58:26 -0000
@@ -151,6 +151,7 @@
        char      *timezone;
        HashTable *tzcache;
        timelib_error_container *last_errors;
+       int guessing_tz;
 ZEND_END_MODULE_GLOBALS(date)
 
 #ifdef ZTS

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to