•  
      request #43339 Unify retrieval of request time
    Infos
    #43339
    Nicolas Terray (nterray)
    2025-06-05 10:40
    2025-06-05 08:44
    45021
    Details
    Unify retrieval of request time

    There are several ways to retrieve the request time in Tuleap:

    • $request->getTime()
    • $_SERVER['REQUEST_TIME']
    • RequestTime::getTimestamp()

    For the sake of consistency, we should keep only one way. RequestTime::getTimestamp() is the safest because it does not trust that the global array $_SERVER contains 'REQUEST_TIME' key.

    Empty
    All
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    New
    Empty
    Attachments
    Empty
    References
    Referencing request #43339

    Follow-ups

    User avatar

    I agree. I suggest to convert to RequestTime::getTimestamp() first. Then it will be easier to use PSR 20.

    User avatar
    Thomas Gerbet (tgerbet)2025-06-05 09:14

    Outside very specific use cases all these 3 should probably be dropped in favor of a PSR 20 Clock implementation (we already pull lcobucci/clock transitively BTW)