[php-src] Issue #11496: UTC Default timezone instead of server local timezone ?
| From: | Wait4Code | Date: | Wed, 21 Jun 2023 06:32:16 +0000 |
| Subject: | [php-src] Issue #11496: UTC Default timezone instead of server local timezone ? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244764@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11496
Author: Wait4Code
### Description
After upgrading my php version from 8.1 to 8.2 I've noticed that the default timezone changed
from the server local to UTC.
To be sure that it does not come from my server setup or my computer, i've set up 2 differents
Dockerfile based on Ubuntu 22.04 and based on the same local timezone : one with php 8.1 and another
with php 8.2.
The one with PHP 8.1 correctly use the container TZ while the other one use UTC.
I've also noticed the same behaviour with Ubuntu 18.04 and 20.04.
Is that a new behaviour of PHP8.2 ? Am I missing something ?
Be aware that php.ini config files are left untouched, they are by default.
Here are the Dockerfiles
PHP 8.1 :
```Dockerfile
FROM ubuntu:22.04
RUN apt-get update --fix-missing
RUN apt-get install -y software-properties-common
RUN apt-get update && \
apt-get install -yq tzdata && \
ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata
RUN add-apt-repository -y ppa:ondrej/php
RUN apt update
RUN apt install -y php8.1
CMD date; php -r 'print_r(new \DateTime("now"));'
```
Output :
```
Wed Jun 21 08:00:22 CEST 2023
DateTime Object
(
[date] => 2023-06-21 08:00:22.532719
[timezone_type] => 3
[timezone] => Europe/Berlin
)
```
PHP 8.2 :
```Dockerfile
FROM ubuntu:22.04
RUN apt-get update --fix-missing
RUN apt-get install -y software-properties-common
RUN apt-get update && \
apt-get install -yq tzdata && \
ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata
RUN add-apt-repository -y ppa:ondrej/php
RUN apt update
RUN apt install -y php8.2
CMD date; php -r 'print_r(new \DateTime("now"));'
```
Output :
```
Wed Jun 21 08:00:16 CEST 2023
DateTime Object
(
[date] => 2023-06-21 06:00:16.449674
[timezone_type] => 3
[timezone] => UTC
)
```
### PHP Version
PHP 8.2
### Operating System
Ubuntu 22.04