php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48851 calling setcookie with "invalid time value" causes high load for apache process
Submitted: 2009-07-08 09:16 UTC Modified: 2015-01-19 23:06 UTC
From: stephan dot schulze at kapthon dot com Assigned: derick (profile)
Status: Not a bug Package: Date/time related
PHP Version: 5.2.10 OS: Centos 5.3
Private report: No CVE-ID: None
 [2009-07-08 09:16 UTC] stephan dot schulze at kapthon dot com
Description:
------------
If you call setcookie with an invalid time value causes high load for the calling apache process

Reproduce code:
---------------
setcookie("SessionID", $S, time() . 15768000, "/");

Expected result:
----------------
Cookie is set and there should be no load for the apache process

Actual result:
--------------
Cookie is set and there is a load of 100% for the apache process

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-10 18:52 UTC] jani@php.net
This loop in ext/date/lib/unixtime2tm.c seems to be the problem:

while (tmp_days >= DAYS_PER_LYEAR) {
..
}

Derick, can that be optimized for such huge timestamps?
 [2009-07-10 19:32 UTC] derick@php.net
It is in 5.3.
 [2015-01-19 23:06 UTC] derick@php.net
-Status: Assigned +Status: Not a bug
 [2015-01-19 23:06 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

This is fixed in 5.3 and later.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC