Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeZone Doesn't Handle Etc/GMT+10 in Php8.1.14 and Php8.2.1 #10285

Closed
oleibman opened this issue Jan 11, 2023 · 5 comments
Closed

DateTimeZone Doesn't Handle Etc/GMT+10 in Php8.1.14 and Php8.2.1 #10285

oleibman opened this issue Jan 11, 2023 · 5 comments

Comments

@oleibman
Copy link

Description

The following code:

<?php
new DateTimeZone('Etc/GMT+10');

Resulted in this output:

Fatal error: Uncaught Exception: DateTimeZone::__construct(): Unknown or bad timezone (Etc/GMT+10) in C:\Users\OwenLeibman\Downloads\php-8.1.14-Win32-vs16-x64\tzbug.php:2
Stack trace:
#0 C:\Users\OwenLeibman\Downloads\php-8.1.14-Win32-vs16-x64\tzbug.php(2): DateTimeZone->__construct('Etc/GMT+10')
#1 {main}
  thrown in C:\Users\OwenLeibman\Downloads\php-8.1.14-Win32-vs16-x64\tzbug.php on line 2

But I expected no output instead:

This error is introduced in Php8.1.14 and 8.2.1 (and 8.3 nightlies). It was not present in 8.1.13 or 8.2.0. It appears that all timezones of the form Etc/GMT+whatever fail; Etc/GMT-whatever continues to work. Etc/GMT+whatever continues to be listed as a supported timezone at https://www.php.net/manual/en/timezones.others.php

PHP Version

Php 8.2.1 and Php 8.1.14

Operating System

Windows

oleibman added a commit to oleibman/PhpSpreadsheet that referenced this issue Jan 11, 2023
Unit tests were failing at Github, having nothing to do with PhpSpreadsheet. Change test to avoid bug, which is reported at php/php-src#10285
oleibman added a commit to PHPOffice/PhpSpreadsheet that referenced this issue Jan 11, 2023
Unit tests were failing at Github, having nothing to do with PhpSpreadsheet. Change test to avoid bug, which is reported at php/php-src#10285
@damianwadley
Copy link
Member

Duplicate of #10218.

Etc/GMT+whatever continues to be listed as a supported timezone at https://www.php.net/manual/en/timezones.others.php

The very first sentence on that page says not to use them.

@damianwadley damianwadley closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2023
@Zenexer
Copy link

Zenexer commented Jan 23, 2023

@damianwadley, the trouble is that these are returned by listIdentifiers when passed ALL_WITH_BC. Even if these are deprecated, the following code shouldn't fail: https://3v4l.org/HMcFD

@derickr
Copy link
Member

derickr commented Jan 24, 2023

@Zenexer This is fixed already, through #10218. I think @damianwadley was too quick labelling this as "not planned". It's not for him to decide that.

@damianwadley
Copy link
Member

"Not planned" in that this specific issue isn't going to have any associated work - because it's a duplicate of another one. The issue of ALL_WITH_BC is something separate.

HMcFD should begin working again when 8.2.2/8.1.15 releases next week.

@Zenexer
Copy link

Zenexer commented Jan 24, 2023

Yup, I just want it on the record--for other people landing here from Google--that this is not, in fact, expected behavior. The code snippet at the 3v4l link should work. You shouldn't be deliberately using these timezones, but anything in listIdentifiers shouldn't throw an exception when passed to DateTimeZone's constructor in the same process. It is a regression, and a fix was merged, although you shouldn't take it as a sign that those timezones are safe to use outside of this specific context.

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

No branches or pull requests

4 participants