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

Fix error TypeError: mb_detect_encoding(): Argument #1 ($string) must be of type string, array given in file Lfm.php with change method translateFromUtf8 #1234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deyan-ardi
Copy link

@deyan-ardi deyan-ardi commented May 14, 2024

Summary of the change:

Fix error in windows os for feature File Moving

TypeError: mb_detect_encoding(): Argument #1 ($string) must be of type string, array given in file C:\laragon\www\laravel\glagalinggah-cms\vendor\unisharp\laravel-filemanager\src\Lfm.php on line 237

I replace method translateFromUtf8($input) from

 public function translateFromUtf8($input)
    {
        if ($this->isRunningOnWindows()) {
            $input = iconv('UTF-8', mb_detect_encoding($input), $input);
        }

        return $input;
  }

To

    public function translateFromUtf8($input)
    {
        if ($this->isRunningOnWindows()) {
            if (is_array($input)) {
                foreach ($input as $k => $i) {
                    $rInput[] = iconv('UTF-8', mb_detect_encoding($i), $i);
                }
            } else {
                $rInput = $input;
            }
        } else {
            $rInput = $input;
        }

        return $rInput;
    }

I hove this fix cant be merge, i get error message in my server, thanks

@deyan-ardi deyan-ardi changed the title fix: replace Lfm.php, change method translateFromUtf8 Fix error TypeError: mb_detect_encoding(): Argument #1 ($string) must be of type string, array given in file Lfm.php, change method translateFromUtf8 May 14, 2024
@deyan-ardi deyan-ardi changed the title Fix error TypeError: mb_detect_encoding(): Argument #1 ($string) must be of type string, array given in file Lfm.php, change method translateFromUtf8 Fix error TypeError: mb_detect_encoding(): Argument #1 ($string) must be of type string, array given in file Lfm.php with change method translateFromUtf8 May 14, 2024
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.

1 participant