php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25050 mktime(); and gmmktime(); using "xx" parameter
Submitted: 2003-08-12 04:23 UTC Modified: 2010-04-03 15:03 UTC
From: tlii_php at bsb dot cz Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.2 OS: Linux
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: tlii_php at bsb dot cz
New email:
PHP Version: OS:

 

 [2003-08-12 04:23 UTC] tlii_php at bsb dot cz
Description:
------------
When is for mktime(); used month parameter in form "xx", then in some cases it appears to produce incorrect output ( timestamp ).
Same situation in gmmktime();

Reproduce code:
---------------
$test1 = mktime(22,00,00,07,01,2003);
$test2 = mktime(22,00,00,08,01,2003);
$test3 = mktime(22,00,00,8,01,2003);
$test4 = mktime(22,00,00,09,01,2003);
$test5 = mktime(22,00,00,9,01,2003);
$test6 = mktime(22,00,00,10,01,2003);

$test7 = gmmktime(22,00,00,8,01,2003);
$test8 = gmmktime(22,00,00,08,01,2003);

echo date("j.m.Y H:i", $test1 )." -- mktime(22,00,00,07,01,2003); <br>";
echo date("j.m.Y H:i", $test2 )." -- mktime(22,00,00,08,01,2003); <br>";
echo date("j.m.Y H:i", $test3 )." -- mktime(22,00,00,8,01,2003); <br>";
echo date("j.m.Y H:i", $test4 )." -- mktime(22,00,00,09,01,2003); <br>";
echo date("j.m.Y H:i", $test5 )." -- mktime(22,00,00,9,01,2003); <br>";
echo date("j.m.Y H:i", $test6 )." -- mktime(22,00,00,10,01,2003); <br><br>";

echo date("j.m.Y H:i", $test7 )." -- gmmktime(22,00,00,8,01,2003); <br>";
echo date("j.m.Y H:i", $test8 )." -- gmmktime(22,00,00,08,01,2003); ";

Actual result:
--------------
1.07.2003 22:00 -- mktime(22,00,00,07,01,2003); 
1.12.2002 22:00 -- mktime(22,00,00,08,01,2003); 
1.08.2003 22:00 -- mktime(22,00,00,8,01,2003); 
1.12.2002 22:00 -- mktime(22,00,00,09,01,2003); 
1.09.2003 22:00 -- mktime(22,00,00,9,01,2003); 
1.10.2003 22:00 -- mktime(22,00,00,10,01,2003); 

2.08.2003 00:00 -- gmmktime(22,00,00,8,01,2003); 
1.12.2002 23:00 -- gmmktime(22,00,00,08,01,2003);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-12 04:32 UTC] derick@php.net
08 does not exist, because the octal number 8 doesn't exist. If you prefix a number with a 0 it marks the number as octal, and because in some cases a number doesnt exist you get weird output. This is not a bug -> bogus.
 [2010-04-03 14:37 UTC] enabled at yandex dot ru
Then why vardump(4==04) is true?
 [2010-04-03 15:03 UTC] pajoye@php.net
bugs.php.net is not a support channel, read http://en.wikipedia.org/wiki/Octal_number if you need more details about octal numbers.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 09:01:32 2024 UTC