php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78120 No more warning for missing timezone
Submitted: 2019-06-06 11:55 UTC Modified: 2021-04-07 16:46 UTC
From: laurent dot lyaudet at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Date/time related
PHP Version: 7.0.0 OS: Debian 9.7
Private report: No CVE-ID: None
 [2019-06-06 11:55 UTC] laurent dot lyaudet at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.date-default-timezone-set
---
The documentation contains
"
    Note:

    Since PHP 5.1.0 (when the date/time functions were rewritten), every call to a date/time function will generate a E_NOTICE if the timezone isn't valid, and/or a E_WARNING message if using the system settings or the TZ environment variable.
"
However, I don't have any warning issued when I run the function date without timezone on Debian 9.7.

root@StretchDevNewLaurent:/home/web/teliway.com/appli# 
  grep -r 'date.timezone' /etc/php/7.0/
/etc/php/7.0/apache2/php.ini:; http://php.net/date.timezone
/etc/php/7.0/apache2/php.ini:;date.timezone =
/etc/php/7.0/phpdbg/php.ini:; http://php.net/date.timezone
/etc/php/7.0/phpdbg/php.ini:;date.timezone =
/etc/php/7.0/cli/php.ini:; http://php.net/date.timezone
/etc/php/7.0/cli/php.ini:;date.timezone =




Test script:
---------------
<?php
echo date('Ymd');
1/0;
?>
20190606PHP Warning:  Division by zero in - on line 3
PHP Stack trace:
PHP   1. {main}() -:0

Warning: Division by zero in - on line 3

Call Stack:
   21.1228     344160   1. {main}() -:0




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-06 12:52 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Documentation problem +Package: Date/time related -PHP Version: 7.1.30 +PHP Version: 7.0.0
 [2019-06-06 12:52 UTC] cmb@php.net
Indeed, there is no longer any warning as of PHP 7.0.0[1].  The
notice for invalid timezones is still issued, though.

[1] <https://www.php.net/manual/en/migration70.other-changes.php#migration70.other-changes.remove-date-timezone-warning>
 [2019-12-16 16:17 UTC] antonino dot spampinato86 at gmail dot com
https://www.php.net/manual/en/migration70.incompatible.php
Your sistem have division by zero.
 [2019-12-17 13:44 UTC] laurent dot lyaudet at gmail dot com
Hello Antonino,

The "1/0;" code line is only here to show that warning/error display is activated,
and that it is not a problem with PHP cli parameter file cli/php.ini.

Best regards,
   Laurent Lyaudet
 [2021-04-07 16:46 UTC] cmb@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-04-07 16:46 UTC] cmb@php.net
This note has been removed in the meantime, since the PHP manual
is no longer supposed to document PHP 5 specifics.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC