Hello,
I am struggling with an issue in my OJS journal. The journal supports two languages one is English and the other one is Persian. The issue is that in submission page, the submission files section is loading properly when the language of the website is English but the same section stucks (loading…) when Persian language is selected.
I provided a screenshot of the issue:
In order to understand what the issue is, I checked the server log and the following error is logged:
PHP Fatal error: Uncaught Error: Call to undefined method IntlCalendar::setGregorianChange() in /lib/pkp/lib/vendor/php81_bc/strftime/src/php-8.1-strftime.php:98, referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
Note: I have intl php extension enabled.
Any help on how to resolve the issue.
Hello dear friend… some times it related to language settings in config.inc.php … at localized part set these settings… I hope your problem will be solved very soon.
;;;;;;;;;;;;;;;;;;;;;;;;;
; Localization Settings ;
;;;;;;;;;;;;;;;;;;;;;;;;;
[i18n]
; Default locale
locale = en
; Database connection character set
client_charset = utf-8
connection_charset = utf8
database_charset = utf8
filesystem_charset = utf8
results_cahrset = utf8
server_charset = utf8
system_charset = utf8
Thanks @monirehbastami ,
But the config file has already the same settings.
Hi @asrarahmadehsan ,
Can you post the full stack trace for the error message?
Thanks,
Alec Smecher
Public Knowledge Project Team
PHP Fatal error: Uncaught Error: Call to undefined method IntlCalendar::setGregorianChange() in /mj.ghalib.edu.af/lib/pkp/lib/vendor/php81_bc/strftime/src/php-8.1-strftime.php:98, referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: Stack trace:, referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #0 /lib/pkp/lib/vendor/php81_bc/strftime/src/php-8.1-strftime.php(201): PHP81_BC\\{closure}(Object(DateTime), '%B'), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #1 [internal function]: PHP81_BC\\{closure}(Array), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #2 /lib/pkp/lib/vendor/php81_bc/strftime/src/php-8.1-strftime.php(180): preg_replace_callback('/(?<!%)%([_#-]?...', Object(Closure), '%B %e, %Y'), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #3 /lib/pkp/controllers/grid/files/FileDateGridColumn.inc.php(56): PHP81_BC\\strftime('%B %e, %Y', Object(DateTime)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #4 /lib/pkp/classes/controllers/grid/ColumnBasedGridCellProvider.inc.php(34): FileDateGridColumn->getTemplateVarsFromRow(Object(SubmissionFilesGridRow)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #5 /lib/pkp/classes/controllers/grid/GridCellProvider.inc.php(49): ColumnBasedGridCellProvider->getTemplateVarsFromRowColumn(Object(SubmissionFilesGridRow), Object(FileDateGridColumn)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #6 /lib/pkp/classes/controllers/grid/GridHandler.inc.php(1104): GridCellProvider->render(Object(Request), Object(SubmissionFilesGridRow), Object(FileDateGridColumn)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #7 /lib/pkp/classes/controllers/grid/GridHandler.inc.php(1011): GridHandler->_renderCellInternally(Object(Request), Object(SubmissionFilesGridRow), Object(FileDateGridColumn)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #8 /lib/pkp/classes/controllers/grid/GridHandler.inc.php(988): GridHandler->renderRowInternally(Object(Request), Object(SubmissionFilesGridRow)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #9 /lib/pkp/classes/controllers/grid/GridHandler.inc.php(1033): GridHandler->renderRowsInternally(Object(Request), Array), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #10 /lib/pkp/classes/controllers/grid/GridHandler.inc.php(923): GridHandler->renderGridBodyPartsInternally(Object(Request)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #11 /lib/pkp/classes/controllers/grid/GridHandler.inc.php(643): GridHandler->doSpecificFetchGridActions(Array, Object(Request), Object(TemplateManager)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #12 /lib/pkp/classes/core/PKPRouter.inc.php(395): GridHandler->fetchGrid(Array, Object(Request)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #13 /lib/pkp/classes/core/PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #14 /lib/pkp/classes/core/Dispatcher.inc.php(144): PKPComponentRouter->route(Object(Request)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #15 /lib/pkp/classes/core/PKPApplication.inc.php(362): Dispatcher->dispatch(Object(Request)), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #16 /index.php(68): PKPApplication->execute(), referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: #17 {main}, referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
stderr: thrown in /lib/pkp/lib/vendor/php81_bc/strftime/src/php-8.1-strftime.php on line 98, referer: https://www.mj.ghalib.edu.af/index.php/mj/authorDashboard/submission/7
Hi @asrarahmadehsan ,
Hmm, I’m not sure why, but it appears that your PHP installation is missing a function (https://www.php.net/manual/en/intlgregoriancalendar.setgregorianchange.php ).
Can you check what your exact PHP version is?
Regards,
Alec Smecher
Public Knowledge Project Team
Hello, @asmecher ,
Thanks for replying, The site is running on PHP 8.2
Hi @asrarahmadehsan ,
Can you check the exact version? There should be something after the 2.
Regards,
Alec Smecher
Public Knowledge Project Team
Hello @asmecher ,
The exact version of PHP: 8.2.12
Hi @asrarahmadehsan ,
Hmm, I’m afraid I can’t replicate that behaviour, and looking through the code, I’m not sure what caused it. It’s possibly something nonstandard about your PHP environment, or an assumption in the coding of a backwards-compatibility library that we use in OJS 3.3.0-x (the line of code in question is here ).
I would recommend working around the problem, if possible. Here are two suggestions:
Upgrade to OJS 3.4.0-x, which does not use the backwards compatibility library
Downgrade your PHP to version 8.0.x or 8.1.x (8.1.x is recommended)
Regards,
Alec Smecher
Public Knowledge Project Team
Hi @asmecher ,
I checked the website with PHP version 8.0 to 8.3 and it only works with PHP 8.0 but that version has reached end of it’s life.
Interesting point is that it works with English as the language of the website but breaks when changed to other language (e.g. Persian).
Should I talk to the Hosting Provider for this problem?
Hi @asrarahmadehsan ,
…breaks when changed to other language (e.g. Persian).
Thanks, that was the hint I needed to reproduce the problem locally.
I’ve filed this for work in the backwards-compatibility library, along with a proposed fix. You should be able to apply the proposed fix in the meantime to work around the problem without complications (in lib/pkp/lib/vendor/php81_bc/strftime
). See for details:
opened 04:10PM - 18 Dec 23 UTC
Try the following test script. (You may have to generate the `fa_IR` locale on y… our system first.)
```php
<?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`.)
Proposed fix:
```diff
diff --git a/src/php-8.1-strftime.php b/src/php-8.1-strftime.php
index 1c7ee37..ebb3f70 100644
--- a/src/php-8.1-strftime.php
+++ b/src/php-8.1-strftime.php
@@ -95,7 +95,9 @@
// in formatted strings.
// To adjust for this, a custom calendar can be supplied with a cutover date arbitrarily far in the past.
$calendar = IntlGregorianCalendar::createInstance();
- $calendar->setGregorianChange(PHP_INT_MIN);
+ // NOTE: IntlGregorianCalendar::createInstance DOES NOT return an IntlGregorianCalendar instance when
+ // using a non-Gregorian locale (e.g. fa_IR)! In that case, setGregorianChange will not exist.
+ if (method_exists($calendar, 'setGregorianChange')) $calendar->setGregorianChange(PHP_INT_MIN);
return (new IntlDateFormatter($locale, $date_type, $time_type, $tz, $calendar, $pattern))->format($timestamp);
};
```
Let me know if I can open a pull request!
(Source: https://forum.pkp.sfu.ca/t/submission-files-is-not-showing-in-ojs-3-3-0-11/83976/10)
Thanks,
Alec Smecher
Public Knowledge Project Team