user ubuntu-de...@lists.ubuntu.com
usertag 730771 + ubuntu-patch
tag 730771 + patch
thanks

On Thu, Dec 12, 2013 at 11:36:03AM +0100, Ondřej Surý wrote:
> On Fri, Nov 29, 2013, at 13:30, Robie Basak wrote:
> > I guess the previous patch needs to be ported forward to 5.5?
> 
> Any volunteers on Canonical side?

I chased this down as I was merging 5.5.8+dfsg-2 in Ubuntu.

Patch attached. It looks like the patch to ext/date/php_date.c was
inadvertently dropped at some point; restoring it fixes the regressed
functionality.

I will simultaneously upload this fix with my merge in Ubuntu.
Subject: Use system timezone
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730771
Bug-Ubuntu: https://launchpad.net/bugs/1244343
Forwarded: not-needed
Acked-By: Robie Basak <robie.ba...@ubuntu.com>
Last-Update: 2014-01-21

Upstream don't want this patch. See
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730771 for a summary.

This delta is recovered from previous versions of the system timezone patch in
Debian, and appears to have inadvertently been dropped. Author unknown.

To be used in tandem with use_embedded_timezonedb.patch and use_embedded_timezonedb_fixes.patch.

---

--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -969,6 +969,23 @@
 		DATEG(timezone_valid) = 1;
 		return DATEG(default_timezone);
 	}
+	/* Try to guess timezone from system information */
+	{
+		struct tm *ta, tmbuf;
+		time_t     the_time;
+		char      *tzid = NULL;
+
+		the_time = time(NULL);
+		ta = php_localtime_r(&the_time, &tmbuf);
+		if (ta) {
+			tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
+		}
+		if (! tzid) {
+			tzid = "UTC";
+		}
+
+		return tzid;
+	}
 	/* Fallback to UTC */
 	php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.");
 	return "UTC";

Reply via email to