php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36988 mktime freezes on long numbers
Submitted: 2006-04-05 18:24 UTC Modified: 2006-04-11 18:03 UTC
From: virtuall at virtuall dot info Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.1.2 OS: Linux, FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
32 + 26 = ?
Subscribe to this entry?

 
 [2006-04-05 18:24 UTC] virtuall at virtuall dot info
Description:
------------
I believe it's not a bug, but it's a really good way to lock down the server for a couple of seconds.

Anyway, mktime does not check if 'year' is a valid number. It accepts any integer value and starts counting the seconds.

IMO mktime should have some limit after which the date is considered invalid and it returns FALSE without even starting to count.

Reproduce code:
---------------
<?php
        $start = microtime(1);
        $a = mktime(1, 1, 1, 1, 1, 11111111111);
        var_dump($a);
        echo number_format(microtime(1) - $start, 2)."\n";
?>


Expected result:
----------------
bool(false)
0.00

Actual result:
--------------
bool(false)
44.57

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-11 18:03 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC