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

Class IntlDateFormatter not found #1251

Closed
MarkArgent opened this issue Nov 17, 2022 · 6 comments
Closed

Class IntlDateFormatter not found #1251

MarkArgent opened this issue Nov 17, 2022 · 6 comments
Labels
core Core functionalities, including the admin section severity: major Major functionality

Comments

@MarkArgent
Copy link

I'm getting the error below when I attempt to edit a field in ACF Pro, this is with ACF Pro 6.0.3, qTranslate-XT 3.12.1, and WordPress 6.1.1. I am seeing this when I click to edit to edit a field group in ACF Pro --- the URL is http://netbsd/angleseyartsforum.org/wp-admin/post.php?post=517&action=edit (that URL goes to an address on my local machine).

Fatal error: Uncaught Error: Class 'IntlDateFormatter' not found in /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php:53 Stack trace: #0 /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php(192): {closure}(Object(DateTime), '%A') #1 [internal function]: {closure}(Array) #2 /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php(194): preg_replace_callback('/(?<!%)(%[a-zA-...', Object(Closure), '%A %B %e%q, %Y') #3 /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php(488): qxtranxf_intl_strftime('%A %B %e%q, %Y', Object(DateTime), 'en_US') #4 /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php(523): qtranxf_format_date('', '2020-02-10 11:5...', '2020-02-10') #5 /home/mark/angleseyartsforum.org/data/wp-includes/class-wp-hook.php(308): qtranxf_dateFromPostForCurrentLanguage('202 in /home/mark/angleseyartsforum.org/data/wp-content/plugins/qtranslate-xt-master/qtranslate_date_time.php on line 53

@vonsch76
Copy link

vonsch76 commented Nov 17, 2022

Seems like some problem in your local install. Check this.

@herrvigg
Copy link
Collaborator

herrvigg commented Nov 18, 2022

Thanks for testing the git code on the master branch.
You need the ext-intl in PHP, I added that in the composer file for information.
See https://www.php.net/manual/en/intl.installation.php

You can check if you have it with phpinfo or with

php -r '$all = get_loaded_extensions(); foreach($all as $i) { $ext = new ReflectionExtension($i); $ver = $ext->getVersion(); echo "$i - $ver" . PHP_EOL;}' | grep intl

I also added a new date/time option to disable any conversion. If you select that, there should be no need for IntlDateFormatter which can be useful until you fix the problem.

@herrvigg herrvigg added the core Core functionalities, including the admin section label Nov 18, 2022
@MarkArgent
Copy link
Author

Thank you --- I'll try this tomorrow

@herrvigg herrvigg changed the title Error message from ACF Pro and qtranslate-xt Class IntlDateFormatter not found Nov 20, 2022
@MarkArgent
Copy link
Author

Thank you. Installing php-intl on my local machine turned out to be rather a pantomine, but has solved the problem.

herrvigg added a commit that referenced this issue Nov 28, 2022
The class is not found if the PHP extension `Intl` is missing.
Give a more comprehensible error message to the admin.
@herrvigg
Copy link
Collaborator

herrvigg commented Nov 28, 2022

Added a new check and give a more comprehensible error message to the admin to change the option.
It will continue to work with the error as if WP date was selected. The error remains until the admin changes the option explicitly or installs the Intl PHP extension.

herrvigg added a commit that referenced this issue Nov 28, 2022
Using directly a date/time format function with an incomplete PHP
setup is an error for the developer, not for the website admin.
Better leave the PHP exception triggering in that case.
The admin still gets the option error in the settings panels.
@herrvigg herrvigg added the severity: major Major functionality label Nov 29, 2022
@herrvigg
Copy link
Collaborator

Released in 3.13.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionalities, including the admin section severity: major Major functionality
Projects
None yet
Development

No branches or pull requests

3 participants