php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50839 log_errors + display_errors = bogus timezone warning in response entity
Submitted: 2010-01-26 01:15 UTC Modified: 2010-03-01 17:04 UTC
From: miqrogroove at gmail dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.3.1 OS: Windows 2003
Private report: No CVE-ID: None
 [2010-01-26 01:15 UTC] miqrogroove at gmail dot com
Description:
------------
There is a situation where PHP will display errors but never log them.  
It almost seems as though error logging is causing errors now?  Is that 
the most useless kind of feedback message ever?  Warning errors are 
causing errors omgah barbeque.

Reproduce code:
---------------
<?php

ini_set('error_reporting', -1);
ini_set('display_errors', 1);
ini_set('log_errors', 1);

trigger_error('Hello', E_USER_ERROR);

?>

Expected result:
----------------
Fatal error: Hello in test.php on line 7

Actual result:
--------------
Warning: trigger_error() [function.trigger-error]: It is not safe to 
rely on the system's timezone settings. You are *required* to use the 
date.timezone setting or the date_default_timezone_set() function. In 
case you used any of those methods and you are still getting this 
warning, you most likely misspelled the timezone identifier. We selected 
'America/New_York' for '-5.0/no DST' instead in test.php on line 7

Fatal error: Hello in test.php on line 7

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-26 01:23 UTC] miqrogroove at gmail dot com
A second way to describe the issue is that the error_log() function is 
throwing bogus errors.  As in:

<?php

ini_set('error_reporting', -1);
ini_set('display_errors', 1);
ini_set('log_errors', 1);

error_log('Hello World');

?>

This causes 'Hello World' to go to disk, and the bogus Warning to go 
to screen.

I used a different example in OP to illustrate the fact that PHP is 
saying that the Warning was generated by any function whether or not 
it uses timezones in the first place.
 [2010-01-26 06:31 UTC] miqrogroove at gmail dot com
I also confirmed that any call to the mail() function results in two 
identical warnings on screen, and one in the log.
 [2010-01-26 07:27 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

IIRC, this was fixed already..then again, you should actually read the error message and do what it suggests? :)
 [2010-01-27 02:03 UTC] miqrogroove at gmail dot com
hi jani,

I followed your link and all it says is:

PHP 5.3
5.3 has no release.
PHP 5.2
5.2 has no release.
PHP 6.0
6.0 has no release.
 [2010-01-27 06:26 UTC] miqrogroove at gmail dot com
> you should actually read the error message and do what it suggests?

As a developer, I don't have the luxury of assuming servers are 
configured a certain way.  Since PHP offers no way to check if the 
default timezone has been set already, the only alternative I have is to 
disable error reporting, so that functions like mail() wont interrupt 
header output or image generation.

If you do find that Windows snapshot for me, could you check if it comes 
with the installer, or if there are any instructions for upgrading 
without the installer?
 [2010-02-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-02-26 06:23 UTC] miqrogroove at gmail dot com
Please keep this bug open.
 [2010-02-26 06:24 UTC] miqrogroove at gmail dot com
Please keep this bug open.
 [2010-03-01 17:04 UTC] jani@php.net
No bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 02:01:30 2024 UTC