Closed matthewgeier closed 3 months ago
Although the locale issue is a problem, and I don't quite understand why it's happening, it's only a minor issue and it's not the cause of the fatal error. We can come back to it later.
Have a look in your PHP error log for a more serious problem, eg an uncaught exception.
Did you manage to check your error log?
[30-Jul-2024 03:32:56 UTC] PHP Notice: Server failed to set locale to ["en-AU.UTF-8","en_AU.UTF-8"] for language tag 'en-AU'. Either install the missing locale or set $override_locale in your MRBS config.inc.php file to a locale that is available on your server. in /data/www2/admin/auth/mrbs-1.11.5/web/language.inc on line 178 [30-Jul-2024 13:32:56 Australia/Sydney] Uncaught exception 'TypeError' in /data/www2/admin/auth/mrbs-1.11.5/web/functions.inc at line 928 abs(): Argument #1 ($num) must be of type int|float, string given
MRBS GET: Array ( [view] => day [year] => 2024 [month] => 7 [day] => 30 [area] => 6 [room] => 22 [hour] => 8 [minute] => 0 ) MRBS POST: Array ( ) MRBS SESSION: Array ( [csrf_token] => 9074deb9f8edb293ecd54443530c2b464ed6c61df9dd86d11f919f95aac9ef5b )
Then further down more errors that appear to related to date processing. [30-Jul-2024 03:32:57 UTC] PHP Notice: Server failed to set locale to ["en-AU.UTF-8","en_AU.UTF-8"] for language tag 'en-AU'. Either install the missing locale or set $override_locale in your MRBS config.inc.php file to a locale that is available on your server. in /data/www2/admin/auth/mrbs-1.11.5/web/language.inc on line 178 [30-Jul-2024 13:37:28 Australia/Sydney] Uncaught exception 'TypeError' in /data/www2/admin/auth/mrbs-1.11.5/web/functions.inc at line 928 abs(): Argument #1 ($num) must be of type int|float, string given
MRBS GET: Array ( [view] => day [year] => 2024 [month] => 7 [day] => 30 [area] => 6 [room] => 22 [hour] => 8 [minute] => 0 ) MRBS POST: Array ( ) MRBS SESSION: Array ( [csrf_token] => 9074deb9f8edb293ecd54443530c2b464ed6c61df9dd86d11f919f95aac9ef5b )
My wild guess is that the locale warning is then causing a time string conversion operation to fail later.
No, it's not to do with the locale - that's a separate issue. The error above is caused by a bug which has already been fixed in the latest development code. You can download it by following the green Code button on this page. Treat it like a whole new release.
To get rid of those error messages, and get proper localised dates you should look to get the en-AU.utf-8 locale installed though. The method to do this depends on your server OS though, so we can't really help.
To get rid of those error messages, and get proper localised dates you should look to get the en-AU.utf-8 locale installed though. The method to do this depends on your server OS though, so we can't really help.
According to the system (RHEL 9.4) it is. I have a /usr/lib/locale/en_AU.utf8 full of files. However further poking about, it looks like PHP will only accept en_AU and it looks like mrbs was automatically selecting en_AU.utf8. I am unsure of how to get PHP (or in this case php-fpm) to believe en_AU.utf8 is valid. However $override_locale = "en-AU"; on config.inc has made that warning go away. Australian English does not require UTF8 to be correctly rendered. The locale will just ensure we get dates in our format instead of North American format.
Mmmm - I'm still puzzled as to why it didn't work before. Even when you set $override_locale = "en-AU";
MRBS will add on the codeset so that it tries to set the locale to 'en-AU.UTF-8' or 'en_AU.UTF-8'. I think I'll write a small diagnostic program to work out what's happening on your system.
Could you run the attached test program please (you'll need to unzip it first) in your MRBS directory, once with the config that gives you the locale error notice and once with the config that doesn't, and post both outputs here?
The outputs should look something like this:
$disable_automatic_language_changing: bool(false)
$default_language_tokens: string(2) "en"
$override_locale: NULL
$lang: string(2) "en"
$locale: string(5) "en-GB"
OS locales: array(2) { [0]=> string(11) "en-GB.UTF-8" [1]=> string(11) "en_GB.UTF-8" }
Testing setlocale()
Locale: 'C.UTF-8' Result: string(7) "C.UTF-8"
Locale: 'C.utf-8' Result: string(7) "C.utf-8"
Locale: 'C' Result: string(1) "C"
Locale: 'en.UTF-8' Result: bool(false)
Locale: 'en.utf-8' Result: bool(false)
Locale: 'en' Result: bool(false)
Locale: 'en_AU.UTF-8' Result: string(11) "en_AU.UTF-8"
Locale: 'en_AU.utf-8' Result: string(11) "en_AU.utf-8"
Locale: 'en_AU' Result: string(5) "en_AU"
Locale: 'en-AU.UTF-8' Result: bool(false)
Locale: 'en-AU.utf-8' Result: bool(false)
Locale: 'en-AU' Result: bool(false)
ResourceBundle::getLocales('')
Class does not exist.
Now the new (development version) and old (1.11.4) are not generating locale warning now. The server was a newly installed RHEL 9.4 system. I wonder if I was missing a library that subsequently got installed. The release 1.11.15 doesn't work, generating time conversion exceptions and users unable to make bookings.
Whether you get the locale warnings seems to depend on your config settings, regardless of which version you are running. As I understand it, with your original config settings you were getting the locale warnings, but when you set $override_locale = "en-AU";
they went away. If that's still the case then I wonder if you could run the test program please in your MRBS directory (either the 1.11.4 release or the development version) once with the failing config settings and once with the one that works?
I have removed the overide_locale and can no longer reproduce the locale warning in 3 versions 11.4, 11.5 *which generates a date processing exception on attempting to make a booking) and the latest out of github. I can only assume a locale package was missing that while doing other installations on the system supplied the dependency. Or it was a timing co-incidence with something else on the same system. One hell of a coincidence though, but possible I guess.
OK, thanks. I'll close the ticket.
Version 1.11.5
To Reproduce
Can not add bookings User is shown - "Whoops! Unfortunately MRBS has encountered a fatal error. Please consult your system administrator."
php-fpm logs -
PHP Notice: Server failed to set locale to ["en-AU.UTF-8","en_AU.UTF-8"] for language tag 'en-AU'. Either install the missing locale or set $override_locale in your MRBS config.inc.php file to a locale that is available on your server. in /data/www2/admin/auth/mrbs-1.11.5/web/language.inc on line 178
Expected behavior The booking for to appear.
Server details (please complete the following information): MRBS version MRBS 1.11.5 Database schema version 82 Database local schema version 1 $auth['type'] none $auth['session'] remote_user Server details Database Source distribution 8.0.36 System Linux avocado 5.14.0-427.22.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jun 10 09:23:36 EDT 2024 x86_64 Server time Tuesday, 30 July 2024 at 1:42:49 pm AEST Server software Apache/2.4.57 (Red Hat Enterprise Linux) OpenSSL/3.0.7 PHP 8.0.30 Extensions Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, bz2, calendar, cgi-fcgi, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imagick, intl, json, ldap, libxml, mbstring, mysqli, mysqlnd, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, posix, rrd, session, shmop, sockets, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, zlib
Your browser is set with the following language preference order: en-AU, en, en-US
Additional context
localectl list-locales
C.UTF-8 en_AU.UTF-8