Re: Why is mktime(0,0,0,0,0,0) E_STRICT?
| From: | Derick Rethans | Date: | Mon, 23 Oct 2006 08:09:48 +0000 |
| Subject: | Re: Why is mktime(0,0,0,0,0,0) E_STRICT? | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-26168@lists.php.net to get a copy of this message | ||
On Mon, 23 Oct 2006, Lukas Kahwe Smith wrote:
> Pierre wrote:
> > On 10/23/06, Pierre <pierre.php@gmail.com> wrote:
> > > Hello,
> > >
> > > On 10/23/06, Ilia Alshanetsky <ilia@prohost.org> wrote:
> > > > Use of mktime(0) and alike is improper use of the function, more over
> > > > generally it can be traced to an undesired code behavior.
> > >
> > > Which is? mktime(0) is just like mktime(24); if it is not the case,
> > > there is a bug (it is the case). But I suppose you mean mktime(0,0,0,
> > > 0,0,0);?
> > >
> > > However and for the clarity/sanitiy of this discussion mktime(0,0,0,
> > > 0,0,0) does not raise any error, mktime(); does.
> > >
> > > To solve the only argument in favour of this error message, Derick
> > > should simply remove the notice and add these three little line before
> > > the arguments parsing:
> > >
> > > if (ZEND_NUM_ARGS() == 0) {
> > > RETURN_LONG((long)time(NULL));
> > > }
> >
> > To be exact:
> >
> > if (NUM_ARGS()==0 && !gmt) { RETURN_LONG((long)time(NULL)); }
> >
> > as gmmktime uses php_mktime as well, but in GMT mode.
>
> Yes, I see no point in pushing this responsibility into the userland,
> especially since its a BC break appearently.
There is no BC break:
derick@kossu:~$ php-5.2dev -derror_reporting=16383 -r 'echo mktime(), "\n";'
Strict standards: mktime(): You should be using the time() function
instead in Command line code on line 1
1161590781
derick@kossu:~$ php-4.4dev -derror_reporting=16383 -r 'echo mktime(), "\n";'
1161590801
regards,
Derick