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

PHP fatal error "Call to undefined method IntlCalendar::setGregorianChange()" with non-Gregorian locales #15

Closed
asmecher opened this issue Dec 18, 2023 · 0 comments

Comments

@asmecher
Copy link
Contributor

asmecher commented Dec 18, 2023

Try the following test script. (You may have to generate the fa_IR locale on your system first.)

<?php

setlocale(LC_ALL, 'fa_IR') || die("Could not set locale!\n");
require_once('autoload.php');

echo PHP81_BC\strftime('%b', time());

You will get a fatal error message:

PHP Fatal error:  Uncaught Error: Call to undefined method IntlCalendar::setGregorianChange() in /path/to/test.php:5
Stack trace:
#0 {main}
  thrown in /path/to/test.php on line 5

This is because IntlGregorianCalendar::createInstance() will not return an IntlGregorianCalendar when the locale is set to something non-Gregorian. (Note that the error message says it's an IntlCalendar.)

Pull request: #16

(Source: https://forum.pkp.sfu.ca/t/submission-files-is-not-showing-in-ojs-3-3-0-11/83976/10)

asmecher added a commit to asmecher/strftime that referenced this issue Dec 18, 2023
alphp added a commit that referenced this issue Dec 18, 2023
#15 Fix fatal error with non-Gregorian locales
@alphp alphp closed this as completed Dec 18, 2023
splitbrain added a commit to splitbrain/strftime that referenced this issue Jan 26, 2024
* master:
  Tests: use assertThat instead assertMatchesRegularExpression
  Fix tests: PHP-7.4 on Windows
  Fix tests: PHP-7.4 on Windows
  Fix tests
  Fix test
  Action: add Windows and macOS test
  Fix test locale eu
  Fix test with PHP-8.3
  Actions: update checkout and cache
  Test only on ubuntu-latest
  Test on matrix
  Fix fatal error when using the default PHP locale alphp#17
  Code review tweaks
  alphp#15 Fix fatal error with non-Gregorian locales
splitbrain added a commit to splitbrain/strftime that referenced this issue Jan 26, 2024
* master:
  Tests: use assertThat instead assertMatchesRegularExpression
  Fix tests: PHP-7.4 on Windows
  Fix tests: PHP-7.4 on Windows
  Fix tests
  Fix test
  Action: add Windows and macOS test
  Fix test locale eu
  Fix test with PHP-8.3
  Actions: update checkout and cache
  Test only on ubuntu-latest
  Test on matrix
  Fix fatal error when using the default PHP locale alphp#17
  Code review tweaks
  alphp#15 Fix fatal error with non-Gregorian locales
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants