php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10550 mktime() returns -1 for certain valid dates
Submitted: 2001-04-29 06:46 UTC Modified: 2001-09-09 06:02 UTC
From: chris dot php at bolt dot cx Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 4.0 Latest CVS (29/04/2001) OS: FreeBSD 3.4-RELEASE
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chris dot php at bolt dot cx
New email:
PHP Version: OS:

 

 [2001-04-29 06:46 UTC] chris dot php at bolt dot cx
$ cat test.php 
<?=
mktime(1, 18, 27, 4, 1, 2001) . "\n" .
mktime(2, 18, 27, 4, 1, 2001) . "\n" .
mktime(3, 18, 27, 4, 1, 2001) . "\n";
?>
$ php -q test.php 
986113107
-1
986116707
$

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-29 07:05 UTC] chris dot php at bolt dot cx
Correction:

$ cat test.php 
<?=
gmmktime(1, 18, 27, 4, 1, 2001, 0) . "\n" .
gmmktime(2, 18, 27, 4, 1, 2001, 0) . "\n" .
gmmktime(3, 18, 27, 4, 1, 2001, 0) . "\n";
?>
$ php -q test.php 
986087907
-21601
986098707
$
 [2001-04-29 11:20 UTC] derick@php.net
I could not reproduce this under Linux. Will try later with OpenBSD. As PHP uses the underlying C functions for this, this might actaully be a problem with FreeBSD.

Derick
 [2001-04-29 11:27 UTC] avsm@php.net
It doesn't occur under OpenBSD; it looks like a FreeBSD issue (happens on 4.x-STABLE as well).  This came up recently on the Horde/Chora list:

http://marc.theaimsgroup.com/?l=chora&m=98622313207343&w=2
 [2001-04-29 15:11 UTC] hholzgra@php.net
daylight saving related??? (u
 [2001-09-09 06:02 UTC] derick@php.net
Closing this one, as it seems an issue with FreeBSD's daylight savings time.
 [2001-09-09 06:02 UTC] derick@php.net
I said closed
 [2002-10-08 11:26 UTC] giovani-spagnolo at procergs dot rs dot gov dot br
It?s really a FreeBSD?s daylight savings bug.

Try:

mktime(0,0,0,10,13,2002) and you?ll get -1.

13/10/2001 is the first day in daylight savings time.

This problem also occurs on windows98.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 09:01:27 2025 UTC