|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50065 Need a way to force calls to time() to be replaced by $_SERVER['REQUEST_TIME']
Submitted: 2009-11-03 17:42 UTC Modified: 2009-11-03 19:50 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: leroutier at gmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.2.11 OS: Linux
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:
Solve the problem:
25 + 21 = ?
Subscribe to this entry?

 [2009-11-03 17:42 UTC] leroutier at gmail dot com
Got lazy developers that can't understand that any call to date, time, strftime and so on without a timestamp as parameter would always mean extra system calls.

So, they get fun adding shitty code like :
$caching_time = mktime(1,0,0,date("m"),date("d")+1,date("Y"))- time();

Cool, 4 syscalls in one expression.

As I can't make them think about my dear servers (they always say something like "add more servers"), I'd like a way in PHP configuration to bypass all calls to time() and timestamp-less calls to be replaced by $_SERVER['REQUEST_TIME']

I understand the correct solution would be to correct their code but I'm sure lots of sysadmins would like this.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-03 19:50 UTC]
There are too many cases where different time() calls expect different results and in your example we'd need to "break" the whole date system to return fake data. Nothing that can be done in a sane way.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat May 21 01:03:49 2022 UTC