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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC