php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54932 gmmktime issues strict standard warning
Submitted: 2011-05-26 03:31 UTC Modified: 2011-07-23 02:40 UTC
Votes:5
Avg. Score:2.8 ± 0.4
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:0 (0.0%)
From: pansit at yahoo dot com dot ph Assigned: frozenfire (profile)
Status: No Feedback Package: Unknown/Other Function
PHP Version: 5.3.6 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pansit at yahoo dot com dot ph
New email:
PHP Version: OS:

 

 [2011-05-26 03:31 UTC] pansit at yahoo dot com dot ph
Description:
------------
A similar problem has been reported and added to the documentation for the use of mktime() without parameters.

Similar thing for gmmktime() when called without parameter generates this strict standard error:

Strict Standards: gmmktime() [function.gmmktime.html]: You should be using the time() function instead

Untested on other system or other version other than the one I specified in this bug report.


Query: Why is time() a more appropriate function to use than gmmktime() even if both would have no parameters?

Upon reading the documentation for mktime() this may have something to do with timezone, though not fully explained. So I added this line before the function:

date_default_timezone_set ('UTC');

also tried it with:

date_default_timezone_set ('Asia/Manila');

It still does the same and also tested it with mktime()


Excerpt from http://www.php.net/manual/en/function.mktime.php:

"Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT or E_WARNING message if using the system settings or the TZ environment variable. See also date_default_timezone_set()"

It's not fully documented as to why invalidating a timezone would present less impact than using a valid TZ environment variable.

Test script:
---------------
gmmktime();


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-01 19:10 UTC] frozenfire@php.net
You raise several concerns in your description, but I'm actually unsure what it is 
that you're reporting, that needs to be fixed. Could you provide more clear 
suggestions for changes, so that I don't need to hunt down what the issue is?
 [2011-07-01 19:11 UTC] frozenfire@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: frozenfire
 [2011-07-02 04:30 UTC] frozenfire@php.net
-Status: Assigned +Status: Feedback
 [2011-07-23 02:40 UTC] frozenfire@php.net
-Status: Feedback +Status: No Feedback
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 09 02:05:54 2022 UTC