Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

[Docs] Improve function.date-default-timezone-get.php #4562

Open

Description

@camlafit

Affected page

https://www.php.net/manual/en/function.date-default-timezone-get.php

Current issue

When date.timezone is undefined date_default_timezone_get() return a different value regarding version used.

Suggested improvement

When date.timezone is undefined date_default_timezone_get() return :

  • UTC only if php version >= 8.2
  • current server timezone if php version <=8.1

Activity

  1. added
    enhancement
    on Mar 25, 2025
  2. philip commented on Mar 25, 2025

    @philip
    Member

    It appears this issue goes beyond date_default_timezone_get() although it's certainly a good start. It appears the change was not fully intentional or is complicated as per php/php-src#11496 -- in any case, this issue certainly deserves more digging into.

  3. camlafit commented on Mar 26, 2025

    @camlafit
    Author

    Hello

    When I opened this issue I was not sure where to open it. I've yet identified this change and collateral effect.
    When we try to check timezone effect on our server , we catch this inconsistance as :

    • before 8.2 ini_get("date.timezone") is empty and date_default_timezone_get() return timezone server
    • after 8.2 ini_get("date.timezone") is no more empty and return UTC , date_default_timezone_get() do same

    To prevent developer to misunderstood this change, could be interesting to provide an "official" note as it's a breaking change.
    An other effect we can't anymore detect if configuration is forced/configured to UTC or without any configuration. To detect this only solution looks to check all configuration file (php.ini, pool.d/*, ...)

    Maybe could be set also at https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone

  4. FlyveHest commented on Apr 9, 2025

    @FlyveHest

    This really should be noted, both on DateTime page, and in the upgrade appendices.

    Just did a pretty big update fra 8.1 to 8.4, and now have a lot of work to fix all the incorrect timestamps in our backend, and we have gone through the appendices with utmost care to avoid situations exactly like this.

    Not to mention the time it took to determine what had actually happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions