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

"timezone (Etc/GMT+6) is not a known timezone" errors with php v8.1.14 #2915

Closed
rfeese opened this issue Jan 9, 2023 · 23 comments
Closed

"timezone (Etc/GMT+6) is not a known timezone" errors with php v8.1.14 #2915

rfeese opened this issue Jan 9, 2023 · 23 comments
Labels
3rd-party Related to 3rd-party code or issues with customization bug confirmed

Comments

@rfeese
Copy link
Contributor

rfeese commented Jan 9, 2023

Preconditions (*)

  1. OpenMage 19.4.20, 19.4.21 (both tested)
  2. php v8.1.14 (php v8.1.13 does not exhibit the issue)
  3. There appears to be a problem with parsing timezones with "plus codes" (ex: "Etc/GMT+6") in php v8.1.14. I think this may be a new bug although the use of these zones is apparently discouraged in php (see php doc link below).
  4. php bug report that may be relevant: DateTimeZone fails to parse time zones that contain the "+" character php/php-src#10218
  5. php docs that discourage use of these zones: https://www.php.net/manual/en/timezones.others.php
  6. I believe that there are zones in the old Zend libs that include these old timezone definitions, and perhaps they can just be eliminated. At this point I am not sure if this is a php bug or what.
  7. Example of problematic zones in Zend data:
    <mapZone other="Dateline Standard Time" territory="001" type="Etc/GMT+12"/>

Steps to reproduce (*)

  1. Edit a product in admin interface and click save.
  2. You will receive an error like: "timezone (Etc/GMT+6) is not a known timezone"
  3. In exception log, there should be an error like: Mage_Eav_Model_Entity_Attribute_Exception: timezone (Etc/GMT+6) is not a known timezone in /var/www/html/marketplace.unl.edu/app/code/core/Mage/Core/Model/Config.php:1450
  4. Note that other things break as well -- customer check-out for instance.

Expected result (*)

  1. Expect to not have timezone errors.

Actual result (*)

  1. error like: "timezone (Etc/GMT+6) is not a known timezone"
  2. In exception log, there should be an error like: Mage_Eav_Model_Entity_Attribute_Exception: timezone (Etc/GMT+6) is not a known timezone in /var/www/html/marketplace.unl.edu/app/code/core/Mage/Core/Model/Config.php:1450
@Mike-Benoit

This comment was marked as off-topic.

@addison74
Copy link
Contributor

As you may know, OpenMage has taken an important step and recently adopted ZF1-Future, which completely replaces everything that previously existed in /app/code/core/Zend and /lib/Zend directories. Until we find a solution, I think it would be advisable to post the issue in this repository https://github.com/Shardj/zf1-future/issues too.

It remains to be analyzed if we follow the PHP recommendations then changes are necessary, most likely all GMT-n/GMT+n variants will be removed, but the change should be made in ZF1-Future repository, if it is not possible we will find a patch type solution.

@elidrissidev
Copy link
Member

Issue confirmed directly after upgrading to PHP 8.1.14.

@elidrissidev elidrissidev added 3rd-party Related to 3rd-party code or issues with customization bug confirmed and removed needs investigation labels Jan 9, 2023
@fballiano
Copy link
Contributor

it kinda seems a php bug but maybe we could open an issue to https://github.com/Shardj/zf1-future to remove those timezones?

@rfeese
Copy link
Contributor Author

rfeese commented Jan 10, 2023

I am not sure what code is actually causing this error. Has anyone been able to narrow it down any further?

@sreichel
Copy link
Contributor

sreichel commented Jan 10, 2023

@rfeese @elidrissidev Can you please check your config? (Admin -> Config -> General -> Locale -> Timezone)

I think invalid timezones can be removed here: Mage_Core_Model_Locale::getOptionTimezones()

(.... or search/debug date_default_timezone_get() calls ... ?!?)

edit: tested with php8.2 and have no errors ....

@sreichel
Copy link
Contributor

it kinda seems a php bug but maybe we could open an issue to https://github.com/Shardj/zf1-future to remove those timezones?

ZF1 uses this file .... https://github.com/unicode-org/cldr/blob/main/common/supplemental/windowsZones.xml

@Sdfendor
Copy link
Contributor

Sdfendor commented Jan 10, 2023

Do I need to set up such a timezone in the store config to be affected by this problem?

Edit: to be affected one needs e.g. switch the system timezone to one mentioned above. After that bug is reproducible (8.1.14). Wasn't sure about that after reading the issue description above (OpenMage 20.0.16).

@elidrissidev
Copy link
Member

@sreichel AFAIK this happens only in 8.1.14, not 8.2. and my timezone is the default from sample data pack.

@Sdfendor
Copy link
Contributor

Sdfendor commented Jan 10, 2023

@elidrissidev I can reproduce the bug in PHP 8.1.14 as well as 8.2.1 (in OpenMage 20.0.16, I'm aware that this is not the most recent OM version).

@addison74
Copy link
Contributor

From what I have analyzed, we are not the only ones affected and the reports are starting to appear. We don't have to modify OpenMage or ZF1-Future. It is a bug in PHP related to the recently timelib update. @derickr should revert the PR until a better solution is found. Details here php/php-src#9700.

Until then, those who face this issue must establish temporary a timezone in the Continent/City format.

@fballiano
Copy link
Contributor

Do I have to enable DeveloperMode or something to see this problem?

@elidrissidev
Copy link
Member

Do I have to enable DeveloperMode or something to see this problem?

Only requirement is to have PHP 8.1.14/8.2.1 and you should the error when you try to save any product (don't forget to reload php-fpm if you've just updated).

@elidrissidev
Copy link
Member

So here's where the "Etc/GMT+n" timezone is coming from: Zend_Date's constructor is trying to infer the timezone from the given date if it's a string (e.g. 2022-12-27T08:15:24-08:00), and of course since it can't establish a mapping between the offset and the proper Continent/City timezone name, it calls Zend_Date::getTimezoneFromString() which uses the generic "Etc/GMT".

https://github.com/Shardj/zf1-future/blob/dadd0c2081377cf4333127861916cc88b87009bb/library/Zend/Date.php#L188-L191

It's not clear to me yet how to fix this temporarily while waiting for a fix from upstream.

@derickr
Copy link

derickr commented Jan 10, 2023

You should really not use the Etc/GMT+1 variants. First of all, these are no different from normal GMT±x names, but most of all because the + and - in them are actually the wrong way around. Etc/GMT+5 is actually GMT-5.

Having said that, this is now fixed for PHP 8.1.15 and PHP 8.2.2 as per php/php-src@d12ba11

@fballiano
Copy link
Contributor

Thank you so much @derickr!

@addison74
Copy link
Contributor

Totally agree. Etc+n/Etc-n should be avoided from now on because they can produce different results. This is actually the official recommendation that was posted before https://www.php.net/manual/en/timezones.others.php.

@elidrissidev
Copy link
Member

@addison74 Issue opened on zf1-future to address this.

@addison74
Copy link
Contributor

If the PHP team warns us not to use those timezone formats, why should they be maintained in ZF1-Future? You did very well @elidrissidev.

@sreichel
Copy link
Contributor

Should PHP 8.1.14 and 8.2.1 be added to composers conflict section?

@fballiano
Copy link
Contributor

Should PHP 8.1.14 and 8.2.1 be added to composers conflict section?

this seems like a great idea

@sreichel
Copy link
Contributor

Mhhh. conflict sections seems wrong, but whats the correct pattern to exclude specific versions for ... ?

    "require": {
        "php": ">=7.3 <8.2",

@fballiano
Copy link
Contributor

I was checking it, it could be something like php": ">=7.3 <=8.1.13 >8.1.14", could it work? maybe we could remove the 8.2 constraint yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd-party Related to 3rd-party code or issues with customization bug confirmed
Projects
None yet
Development

No branches or pull requests

8 participants