Skip to content

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

@asmecher

Description

@asmecher

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions