Skip to content

Use Minz_Translate::exists() for language check in createUser()#7934

Merged
Alkarex merged 2 commits intoFreshRSS:edgefrom
Inverle:set-lang-consistency
Sep 9, 2025
Merged

Use Minz_Translate::exists() for language check in createUser()#7934
Alkarex merged 2 commits intoFreshRSS:edgefrom
Inverle:set-lang-consistency

Conversation

@Inverle
Copy link
Member

@Inverle Inverle commented Sep 9, 2025

(consistency)

Related / follow-up: #7878

if ($ok) {
$languages = Minz_Translate::availableLanguages();
if (empty($userConfig['language']) || !in_array($userConfig['language'], $languages, true)) {
if (!Minz_Translate::exists(is_string($userConfig['language']) ? $userConfig['language'] : '')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the following works? It could be simpler

Suggested change
if (!Minz_Translate::exists(is_string($userConfig['language']) ? $userConfig['language'] : '')) {
if (!Minz_Translate::exists($userConfig['language'] ?? '')) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't

 ------ -------------------------------------------------------------------------------------------
  Line   app/Controllers/userController.php
 ------ -------------------------------------------------------------------------------------------
  308    Parameter #1 $lang of static method Minz_Translate::exists() expects string, mixed given.
         🪪  argument.type
 ------ -------------------------------------------------------------------------------------------

@Alkarex Alkarex added this to the 1.27.1 milestone Sep 9, 2025
@Alkarex Alkarex merged commit 087df1e into FreshRSS:edge Sep 9, 2025
1 check passed
@Inverle Inverle deleted the set-lang-consistency branch September 9, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants