php.net |  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
Votes:1
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
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: leroutier at gmail dot com
New email:
PHP Version: OS:

 

 [2009-11-03 17:42 UTC] leroutier at gmail dot com
Description:
------------
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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-03 19:50 UTC] johannes@php.net
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: Wed Jan 19 20:03:14 2022 UTC