#1069785 System Time Zone Not Honoured

#1069785#5
Date:
2024-04-24 17:58:37 UTC
From:
To:
PHP isn't parsing the system time zone like it used to be, instead
defaulting to UTC.

Here is a test script:

   <?php
   print date_default_timezone_get() . "\n";

Running this with PHP 8.1 (and earlier) vs 8.2 produces different output:

# php8.1 foo.php
America/New_York
# php8.2 foo.php
UTC

The patch that is supposed to make this work is
debian/patches/0021-Use-system-timezone.patch, but it apparently no
longer works.

Others have noticed, but upstream says the default has always been UTC:
https://github.com/php/php-src/issues/11496

That issue has a link to a commit that may have broken the patch:
https://github.com/php/php-src/commit/6770158d474fa442ce55bba4ec32dd2703828b33

It seems that the commit sets the default to "UTC" rather than "", which
probably overrides the patch-determined value.

Proper POSIX behaviour is to honour the timezone passed in via
environment, so it would be good to restore correct behaviour.

#1069785#10
Date:
2024-04-24 19:21:24 UTC
From:
To:
I have briefly tested a patch that largely reverts the 8.2 behaviour,
built on top of the two debian timezone patches.

I don't have a full understanding of how these functions interact, so
there might be corner cases not covered, but it is possible to get the
old behaviour back, especially in the default case.