wintercms / winter

Free, open-source, self-hosted CMS platform based on the Laravel PHP Framework.
https://wintercms.com
MIT License
1.37k stars 194 forks source link

Error when remaning folder in media manager #629

Closed AllARTSoftworks closed 2 years ago

AllARTSoftworks commented 2 years ago

Winter CMS Build

1.2

PHP Version

8.1

Database engine

MySQL/MariaDB

Plugins installed

Winter.Demo, Winter.Translate, Marcomessa.Vite, Utopigs.Seo, Winter.Pages, Excodus.TranslateExtended

Issue description

When trying to rename a folder in media manager a popup with this text shows up:

"Backend\Widgets\MediaManager::onLoadRenamePopup(): Return value must be of type array, string returned" on line 367 of [path]/modules/backend/Widgets/MediaManager.php

error

Steps to replicate

Go to Media Manager, hover on folder, click on the right icon to open popup

Workaround

No response

arvislacis commented 2 years ago

Because https://github.com/wintercms/winter/blob/3be17f520b84bc7b22f3ea1435b030483fcaf3a0/modules/backend/widgets/MediaManager.php#L355 expects array as return type of function but the https://github.com/wintercms/winter/blob/3be17f520b84bc7b22f3ea1435b030483fcaf3a0/modules/backend/widgets/MediaManager.php#L367 looks like return only string of partial content.

So either return type of function should be changed (most likely) to string or mixed, or returned data structure.

LukeTowers commented 2 years ago

@arvislacis you are correct, the return type should be changed to string. Would you like to submit a PR to fix that for us?

arvislacis commented 2 years ago

@LukeTowers Done in https://github.com/wintercms/winter/pull/632