#45191 [NEW]: error_log ignores date.timezone php.ini val when setting logging timestamps

From: Date: Thu, 05 Jun 2008 23:50:30 +0000
Subject: #45191 [NEW]: error_log ignores date.timezone php.ini val when setting logging timestamps
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-125540@lists.php.net to get a copy of this message
From:             info at organicdata dot co dot za
Operating system: Centos el5
PHP version:      5.2CVS-2008-06-05 (snap)
PHP Bug Type:     Date/time related
Bug description:  error_log ignores date.timezone php.ini val when setting logging timestamps

Description:
------------
I've noticed that changing the default PHP timezone using either php.ini
date.timezone or date_default_timezone_set appears to have no effect on the
timestamp used for each entry PHP writes to the file set by php.ini value
error_log (when php.ini log_errors = On)

It seems to use the system timestamp regardless. I've done some searching
on the web but found nothing and am afraid I'm not sure whether a bug or by
design but it seems strange enough to submit here

Reproduce code:
---------------
php.ini
-------
log_errors = On
error_log = myerrors.log

mycode.php
----------
error_reporting(E_STRICT);
date_default_timezone_set("UTC");
SOMEBADCONSTANT
date_default_timezone_set("Africa/Johannesburg");
ANOTHERBADCONSTANT

resulting myerrors.log
----------------------
[06-Jun-2008 00:41:34] PHP Notice:  Use of undefined constant
SOMEBADCONSTANT - assumed 'SOMEBADCONSTANT' in /prj/mycode.php on line 3
[06-Jun-2008 00:41:34] PHP Notice:  Use of undefined constant
ANOTHERBADCONSTANT - assumed 'ANOTHERBADCONSTANT' in /prj/mycode.php on
line 5


Expected result:
----------------
As Africa/Johannesburg is 2 hours ahead of UTC, I would have expected the
second myerrors.log entry to read
[06-Jun-2008 02:41:34] PHP Notice:  Use of undefined constant
ANOTHERBADCONSTANT - assumed 'ANOTHERBADCONSTANT' in /prj/mycode.php on
line 5

And even if the comment is that date_default_timezone_set has no effect, I
saw the same when changing date.timezone in php.ini 

The error logging appears to ignore it completely and simply use the
system time


-- 
Edit bug report at http://bugs.php.net/?id=45191&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45191&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45191&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45191&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45191&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45191&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45191&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45191&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45191&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45191&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45191&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45191&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45191&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45191&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45191&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45191&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45191&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45191&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45191&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45191&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45191&r=mysqlcfg



Thread (19 messages)

« previous php.bugs (#125540) next »