php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60723 error_log error time has changed to UTC ignoring default timezo
Submitted: 2012-01-12 09:08 UTC Modified: 2012-09-24 03:04 UTC
Votes:114
Avg. Score:4.0 ± 0.9
Reproduced:104 of 104 (100.0%)
Same Version:35 (33.7%)
Same OS:19 (18.3%)
From: olemarkus at gentoo dot org Assigned: derick
Status: Closed Package: Date/time related
PHP Version: 5.3.9 OS: Gentoo Linux
Private report: No CVE-ID:
 [2012-01-12 09:08 UTC] olemarkus at gentoo dot org
Description:
------------
PHP error log no longer respects timezone and always logs in UTC.

Setting error_log to a filesystem path and date.default_timezone to e.g 
Europe/Oslo gives the following log lines in 5.3.8:

[12-Jan-2012 10:02:38] PHP Notice:  Undefined variable: foo in 
/home/htdocs/index.php on line 3
[12-Jan-2012 10:02:38] PHP Fatal error:  Call to a member function bar() on a 
non-object in /home/htdocs/index.php on line 3

While in 5.3.9 you get:

[12-Jan-2012 09:06:00 UTC] PHP Notice:  Undefined variable: foo in 
/home/htdocs/index.php on line 3
[12-Jan-2012 09:06:00 UTC] PHP Fatal error:  Call to a member function bar() on 
a non-object in /home/htdocs/index.php on line 3

Also see downstream bug: https://bugs.gentoo.org/show_bug.cgi?id=398445


Patches

bug60723.patch (last revision 2012-09-21 03:17 UTC) by laruence@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-20 10:29 UTC] tomop at teamgedoh dot net
I have the same problem.

 The "localtime" argument passed to the php_format_date() function
was changed from 1 to 0 between 5.3.8 and 5.3.9.

 Did it cause the problem?


In /[svn]/php/php-src/branches/PHP_5_3/main/main.c
*revision 319750, line 602:
    error_time_str = php_format_date("d-M-Y H:i:s", 11, error_time, 1 TSRMLS_CC);

*revision 319823, line 602:
    error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC);
 [2012-01-22 19:50 UTC] rasmus@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: derick
 [2012-01-31 13:58 UTC] canderson at tmcc dot edu
I have the same issue running PHP 5.3.9 on Windows IIS 7.5
 [2012-01-31 15:19 UTC] derick@php.net
-Package: *General Issues +Package: Date/time related
 [2012-01-31 15:19 UTC] derick@php.net
Hi!

We had to change this in order to prevent crashes (like in https://bugs.php.net/bug.php?id=60373). I'll check whether there is a better way to fix it.

cheers,
Derick
 [2012-02-05 15:50 UTC] gemini dot geek at yahoo dot com
hi,

I am having the same issue , i am having php 5.3.9 on "CENTOS 6.2 x86_64"


Deepak
 [2012-03-15 16:42 UTC] mitek17 at gmail dot com
Same problem, php 5.3.9; FreeBSD 8.0 & 9.0
 [2012-03-23 13:02 UTC] ebert dot chris at gmail dot com
Same problem for me on IIS 7, Windows 2008 Webserver, PHP 5.3.10
 [2012-03-29 05:34 UTC] sevencat at gmail dot com
Same. PHP 5.3.10 CentOS 5
 [2012-04-04 09:30 UTC] valinurovam at gmail dot com
I have same problem

php -v
PHP 5.3.10 (cli) (built: Feb  4 2012 07:36:51)

CentOS release 6.2 (Final)
 [2012-04-12 14:16 UTC] reggie at busicast dot com
Same:

PHP 5.3.10 with Suhosin-Patch (cli) (built: Mar 14 2012 11:01:12) (DEBUG)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
 [2012-04-19 22:17 UTC] tao dot li1 at renren-inc dot com
Is there any path? PHP 5.3.10
 [2012-05-17 13:12 UTC] gyouja at pilgrims dot ru
Is there any progress with solution for this bug?
 [2012-06-06 05:03 UTC] ramsy at ramix dot jp
The merit which makes this message UTC fixation is not known. 
How about changing in this way? 

---- in main/main.c
-error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC);
+error_time_str = php_format_date("d-M-Y H:i:s T", 13, error_time, 1 TSRMLS_CC);
----

---- output(date.timezone='Asia/Tokyo')
[06-Jun-2012 13:54:12 JST] foo
----
 [2012-06-14 00:35 UTC] kris dot glynn at virginaustralia dot com
Present also in PHP 5.3.13


CentOS release 5.7 (Final)
Linux blah 2.6.18-274.18.1.el5PAE #1 SMP Thu Feb 9 13:25:50 EST 2012 i686 i686 i386 GNU/Linux


PHP 5.3.13 (cli) (built: Jun 13 2012 14:53:50) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
 [2012-07-08 02:39 UTC] likekidz at 126 dot com
same problem in PHP 5.3.14 and 5.4.4
my OS is Windows XP
 [2012-07-13 10:15 UTC] akempiak at odiso dot com
Same, PHP 5.3.14 Debian Squeeze
 [2012-07-20 03:06 UTC] ramsy at ramix dot jp
Why is it neglected? 
The cause of this bug is specification change by the wrong bug fix method.
 [2012-08-24 14:31 UTC] martin dot marques at gmail dot com
Is someone working on this? It's quite an annoying bug.
 [2012-08-24 16:13 UTC] mike dot nicewarner at gmail dot com
I'm using PHP 5.3.13 on Windows, and I'm also experiencing this annoying bug.  
Please, please fix it.  I liked when it used the server timezone settings.
 [2012-09-20 12:47 UTC] wegan at americantextile dot com
Also having this issue on 5.4.1 running on Windows 2008 R2.  Very annoying!  Wish I never upgraded us from 5.3.8!!!
 [2012-09-21 03:01 UTC] laruence@php.net
seems introduced after the fix of: https://bugs.php.net/bug.php?id=60373
 [2012-09-21 03:17 UTC] laruence@php.net
The following patch has been added/updated:

Patch Name: bug60723.patch
Revision:   1348197432
URL:        https://bugs.php.net/patch-display.php?bug=60723&patch=bug60723.patch&revision=1348197432
 [2012-09-21 03:19 UTC] ramsy at ramix dot jp
laruence:
It will be a peculiar problem in ZTS. 
I think that it does not become a reason fixed to UTC in all?
 [2012-09-21 05:16 UTC] laruence@php.net
yes,I have attached a patch, will
commit it later, I am not able to do a whole test now:)
 [2012-09-21 11:01 UTC] junk at ipercolate dot net
Hi,

I don't think the existing behaviour (string format) should be changed, for most users.  I expect there will be many shell scripts that will break slightly because the TZ is now written into the error_time_str.   I have patched my build to only add the TZ to the string if expected behaviour is different (ie logged time is in UTC).

I revert to original behaviour on initially setting error_time_str (localtime = 1), and then add an '#ifdef ZTS' to set it with localtime = 1 and include 'e' in the format string.

I can add this patch file ?

cheers,
 [2012-09-21 12:43 UTC] junk at ipercolate dot net
sorry, a typo above.  I set localtime to 0 (zero) ifdev ZTS

cheers,
 [2012-09-21 12:59 UTC] laruence@php.net
@junk I think the format of output should be consistent. which means either all 
include the 'e', or all don't.
 [2012-09-23 14:59 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 [2012-09-23 14:59 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=395d77c540a2d9d0745c8b4c75d60599c6e17c87
Log: Fixed bug #60723 (error_log error time has changed to UTC ignoring default timezo)
 [2012-09-23 15:01 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=395d77c540a2d9d0745c8b4c75d60599c6e17c87
Log: Fixed bug #60723 (error_log error time has changed to UTC ignoring default timezo)
 [2012-09-23 15:02 UTC] laruence@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-09-23 19:17 UTC] akempiak at odiso dot com
Hi,
this "bug" is fixed ?
which version of PHP will this fix be committed in ?
Thank you.
 [2012-09-24 02:59 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=923511d364ad84500bb097aca15385129ce6e336
Log: Fixed bug #60723 (error_log error time has changed to UTC ignoring default timezo)
 [2012-09-24 03:01 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=923511d364ad84500bb097aca15385129ce6e336
Log: Fixed bug #60723 (error_log error time has changed to UTC ignoring default timezo)
 [2012-09-24 03:01 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=923511d364ad84500bb097aca15385129ce6e336
Log: Fixed bug #60723 (error_log error time has changed to UTC ignoring default timezo)
 [2012-09-24 03:04 UTC] laruence@php.net
hey, committed to 5.3 5.4 branches, will fixed in next release, thanks
 [2012-10-10 21:19 UTC] pixelchutes at gmail dot com
Should hopefully be released in 5.3.18, since 5.3.17 was released just a few days 
before the patch was committed (13-Sep-2012 vs 23-Sep-2012). Glad to hear this 
has been resolved, thanks!
 [2013-01-28 15:24 UTC] spam2 at rhsoft dot net
i do not see anything fixed 
errorlog still contains the timezone

PHP 5.3.21 as also 5.4.11

[28-Jan-2013 16:22:38 Europe/Vienna] PHP Parse error:  syntax error, unexpected end of file in Command line code on line 1

the sysadmin knows his timezone well enough...................
 [2013-02-25 11:14 UTC] martin dot marques at gmail dot com
Don't see the fix in Debians testing packages (specifically 5.4.4), still seeing the UTC time instead of the local time:

# apt-cache policy php5
php5:
  Instalados: 5.4.4-13
  Candidato:  5.4.4-13
  Tabla de versión:
     5.5.0~alpha4-1 0
         40 http://ftp.de.debian.org/debian/ experimental/main i386 Packages
 *** 5.4.4-13 0
        500 http://ftp.de.debian.org/debian/ testing/main i386 Packages
         50 http://ftp.de.debian.org/debian/ unstable/main i386 Packages
        100 /var/lib/dpkg/status
     5.3.3-7+squeeze14 0
        500 http://security.debian.org/ squeeze/updates/main i386 Packages
        500 http://ftp.de.debian.org/debian/ stable/main i386 Packages

From the log file:

[25-Feb-2013 11:05:46 UTC] PHP Deprecated:  Assigning the return value of new by reference is deprecated in /usr/share/php/MDB2.php on line 390
 [2013-03-06 19:25 UTC] pixelchutes at gmail dot com
I can confirm this has indeed been patched (Confirmed for v5.3.22)

BEFORE:
[04-Mar-2013 00:39:07 UTC] PHP Warning:

AFTER:
[06-Mar-2013 06:27:16 America/Denver] PHP Warning:
 [2013-04-07 13:04 UTC] andrea dot ganduglia at gmail dot com
I can confirm that the problem persist on Debian testing

# apt-cache policy php5
php5:
  Installed: 5.4.4-14
  Candidate: 5.4.4-14
  Version table:
 *** 5.4.4-14 0
        500 http://mirrors.gandi.net/debian/ wheezy/main amd64 Packages
        100 /var/lib/dpkg/status

# tail -1 error.log
[07-Apr-2013 11:30:56 UTC] PHP Strict Standards ...
 [2014-03-01 13:28 UTC] aneganov at gmail dot com
Hi!

Bug persist on Debian GNU/Linux 7.0 and php 5.4.4-14+deb7u7:

[01-Mar-2014 13:24:32 UTC] creating new js file public://languages/ru_NBsyVj40mmTmz4zs-DHETmx_j2Ja7-xOshWB5Uwho1M.js


$ LC_ALL=POSIX date
Sat Mar  1 17:28:31 MSK 2014

Any glue why is hasn't been fixed yet?
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 04:02:11 2014 UTC