-
Notifications
You must be signed in to change notification settings - Fork 80
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
InvalidArgumentException: The locale option does not look like a valid locale #67
Comments
Good catch. Do you want to create a pull request? |
Sure, there it is 🙂 |
@madeincosmos thanks for working on this! @rlanvin our project depends on this fix, is there a new release planned anytime soon? |
@bor0 Sure, I just released version 2.1.0 now. |
@rlanvin thank you! Kudos for the fast response :) |
Have same issue with:
In order to fix this is mandatory to install |
Hi @FROXZ, no it's not - I believe the reason you're seeing this error is that "C" as a locale is simply not supported (since it doesn't correspond to any language file). |
Hi @rlanvin thank you for reply. Seems this works without chaning php/server locale: $rrule->humanReadable([
'use_intl' => false,
'locale' => 'en',
]); P.S. Thank you for amazing library. |
This error is only triggered when
intl
fails to load:The regex here expects locale in format such as
en_US.UTF-8
instead of what's given:https://github.com/rlanvin/php-rrule/blob/master/src/RRule.php#L2084
According to
setlocale
specs, all these extra parameters will normally be returned forsetLocale(LC_ALL, 0)
, which is called here:https://github.com/rlanvin/php-rrule/blob/master/src/RRule.php#L2193
To only get
en_US.UTF-8
we'll want to useLC_CTYPE
instead:https://www.php.net/manual/en/function.setlocale.php#106811
Applying this change on my test site solved the problem for me.
The text was updated successfully, but these errors were encountered: