linuxforphp / filebrowser

FileBrowser is a free, open-source, self-hosted web application for managing files and folders.
Other
28 stars 0 forks source link

Bug report #3

Closed StefanoOcchetti closed 1 year ago

StefanoOcchetti commented 2 years ago

Describe the bug Unable to upload any file

To Reproduce Steps to reproduce the behavior:

  1. create a Dockerfile with the following content:

FROM ubuntu

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update RUN apt install -y wget zip unzip php apache2 libapache2-mod-php php-zip

WORKDIR /var/www/ RUN wget https://filebrowser.linuxforphp.net/files/filebrowser-8.0.2.zip RUN unzip filebrowser-8.0.2.zip && rm filebrowser-8.0.2.zip

RUN chown -R www-data:www-data filebrowser/ RUN chmod -R 775 filebrowser/

RUN echo "\ <VirtualHost *:80>\n\ DocumentRoot /var/www/filebrowser/dist\n\ \n\ " >> /etc/apache2/sites-available/filebrowser.conf

RUN a2dissite 000-default.conf RUN a2ensite filebrowser.conf

CMD service apache2 restart \ && tail -f /dev/null

  1. Build the docker image with:

    docker build -t my-php-app .

  2. Run the image with:

    docker run -it --rm --name my-running-app -p 4000:80 my-php-app

  3. With a browser, access the file browser at: http://localhost:4000, username: admin; password: admin123

  4. Click on "Add files" and try to upload a file

  5. A red line appears on the bottom, and no file is uploaded image

  6. looking at the log file inside the container, the following error is reported:

    [2022-05-23 06:56:10] default.ALERT: Fatal Error (E_ERROR): Uncaught Error: Call to a member function isValid() on array in /var/www/filebrowser/backend/Controllers/UploadController.php:71 Stack trace: #0 [internal function]: Filebrowser\Controllers\UploadController->upload() #1 /var/www/filebrowser/vendor/php-di/invoker/src/Invoker.php(82): call_user_func_array() #2 /var/www/filebrowser/vendor/php-di/php-di/src/Container.php(276): Invoker\Invoker->call() #3 /var/www/filebrowser/backend/Services/Router/Router.php(81): DI\Container->call() #4 /var/www/filebrowser/backend/App.php(34): Filebrowser\Services\Router\Router->init() #5 /var/www/filebrowser/dist/index.php(95): Filebrowser\App->__construct() #6 {main} thrown {"code":1,"message":"Uncaught Error: Call to a member function isValid() on array in /var/www/filebrowser/backend/Controllers/UploadController.php:71\nStack trace:\n#0 [internal function]: Filebrowser\Controllers\UploadController->upload()\n#1 /var/www/filebrowser/vendor/php-di/invoker/src/Invoker.php(82): call_user_func_array()\n#2 /var/www/filebrowser/vendor/php-di/php-di/src/Container.php(276): Invoker\Invoker->call()\n#3 /var/www/filebrowser/backend/Services/Router/Router.php(81): DI\Container->call()\n#4 /var/www/filebrowser/backend/App.php(34): Filebrowser\Services\Router\Router->init()\n#5 /var/www/filebrowser/dist/index.php(95): Filebrowser\App->__construct()\n#6 {main}\n thrown","file":"/var/www/filebrowser/backend/Controllers/UploadController.php","line":71,"trace":null} []

Expected behavior Selected file should be uploaded.

Screenshots See above.

Logs excerpted from container's file /private/logs/app.log:

[2022-05-23 06:56:10] default.ALERT: Fatal Error (E_ERROR): Uncaught Error: Call to a member function isValid() on array in /var/www/filebrowser/backend/Controllers/UploadController.php:71 Stack trace: #0 [internal function]: Filebrowser\Controllers\UploadController->upload() #1 /var/www/filebrowser/vendor/php-di/invoker/src/Invoker.php(82): call_user_func_array() #2 /var/www/filebrowser/vendor/php-di/php-di/src/Container.php(276): Invoker\Invoker->call() #3 /var/www/filebrowser/backend/Services/Router/Router.php(81): DI\Container->call() #4 /var/www/filebrowser/backend/App.php(34): Filebrowser\Services\Router\Router->init() #5 /var/www/filebrowser/dist/index.php(95): Filebrowser\App->__construct() #6 {main} thrown {"code":1,"message":"Uncaught Error: Call to a member function isValid() on array in /var/www/filebrowser/backend/Controllers/UploadController.php:71\nStack trace:\n#0 [internal function]: Filebrowser\Controllers\UploadController->upload()\n#1 /var/www/filebrowser/vendor/php-di/invoker/src/Invoker.php(82): call_user_func_array()\n#2 /var/www/filebrowser/vendor/php-di/php-di/src/Container.php(276): Invoker\Invoker->call()\n#3 /var/www/filebrowser/backend/Services/Router/Router.php(81): DI\Container->call()\n#4 /var/www/filebrowser/backend/App.php(34): Filebrowser\Services\Router\Router->init()\n#5 /var/www/filebrowser/dist/index.php(95): Filebrowser\App->__construct()\n#6 {main}\n thrown","file":"/var/www/filebrowser/backend/Controllers/UploadController.php","line":71,"trace":null} []

Environment (please complete the following information):

andrewscaya commented 2 years ago

Hello again @StefanoOcchetti!

We'll have a look at your issue today. In the meatime, maybe you can confirm that you have set the correct permissions (Web server can write) on the folder that the FileBrowser will be using to upload the files.

Many thanks for reporting this, and we'll get back to you shortly, once we will have successfully reproduced your issue.

Cheers!

StefanoOcchetti commented 2 years ago

Hello again @StefanoOcchetti!

We'll have a look at your issue today. In the meatime, maybe you can confirm that you have set the correct permissions (Web server can write) on the folder that the FileBrowser will be using to upload the files.

Many thanks for reporting this, and we'll get back to you shortly, once we will have successfully reproduced your issue.

Cheers!

Hi!

I accessed the running container using "docker exec -it /bin/bash" and manually set chmod 777 to:

filebrowser/dist
filebrowser/private
filebrowser/repository

but the problem still occurs.

Here's a ls -la of the filebrowser directory:

root@e35150b47a47:/var/www/filebrowser# ls -la
total 980
drwxrwxr-x 1 www-data www-data   4096 May 26 08:08 .
drwxr-xr-x 1 root     root       4096 May 21 09:03 ..
-rwxrwxr-x 1 www-data www-data    562 Jul 19  2021 LICENSE
drwxrwxr-x 1 www-data www-data   4096 Jul 19  2021 backend
-rwxrwxr-x 1 www-data www-data   1284 Jul 19  2021 composer.json
-rwxrwxr-x 1 www-data www-data 180816 Jul 19  2021 composer.lock
drwxrwxr-x 1 www-data www-data   4096 Jul 19  2021 config
-rw-r--r-- 1 www-data www-data   3418 May 26 08:08 configuration.php
-rwxrwxr-x 1 www-data www-data   3418 Jul 19  2021 configuration_sample.php
drwxrwxrwx 1 www-data www-data   4096 Aug  2  2021 dist
-rwxrwxr-x 1 www-data www-data    267 Jul 19  2021 index.php
-rwxrwxr-x 1 www-data www-data 732662 Jul 19  2021 package-lock.json
-rwxrwxr-x 1 www-data www-data   1359 Jul 19  2021 package.json
drwxrwxrwx 1 www-data www-data   4096 Jul 30  2021 private
drwxrwxrwx 1 www-data www-data   4096 Jul 19  2021 repository
-rwxrwxr-x 1 www-data www-data    142 Jul 19  2021 robots.txt
drwxrwxr-x 1 www-data www-data   4096 Jul 19  2021 vendor
root@e35150b47a47:/var/www/filebrowser#
andrewscaya commented 2 years ago

@StefanoOcchetti --

OK. Many thanks!

We'll have a look at this issue very shortly. Our initial evaluation leads us to believe that the issue is related to the fact of running the latest version of the FileBrowser on PHP 8.1. But, this being said, we will continue investigating this issue over the next week or so. If it is related to PHP 8.1, this issue will be resolved with the upcoming major release (issue #1).

Cheers!

P.S. We will update the documentation (issue #2) as soon as this issue is done being evaluated, because we don't want to multiply the number of releases only for the docs. We'll keep you posted, and thanks again!

halomakes commented 2 years ago

yeah, I was able to run it on php 7.x. I have my dockerfile in a gist here if you want it https://gist.github.com/halomademeapc/4b92ca454e381d41ca33ae74034e988c

StefanoOcchetti commented 2 years ago

yeah, I was able to run it on php 7.x. I have my dockerfile in a gist here if you want it https://gist.github.com/halomademeapc/4b92ca454e381d41ca33ae74034e988c

@halomademeapc thank you very much! I'll give it a try!

andrewscaya commented 2 years ago

Hello @halomademeapc and @StefanoOcchetti !

Yes, the underlying FlySystem version 1 has issues with PHP 8. The next step is to upgrade to FlySystem 2.4.5. We'll start thinking about v3 in about six months from now.

Many thanks!

Andrew

StefanoOcchetti commented 1 year ago

Hello!

I'm almost sure that the permissions are ok. In any case, I tried to create a new file and the operation succeeded.

Thanks!

Best regards,

@. Stefano Occhetti Senior Software Engineer ORShttp://www.ors.it/ s.r.l. Office: +39 0173 620211 Email: @*.**@*.***> | www.ors.aihttp://www.ors.ai/

From: Andrew Caya @.> Sent: 24 May 2022 17:00 To: linuxforphp/filebrowser @.> Cc: Stefano Occhetti @.>; Mention @.> Subject: Re: [linuxforphp/filebrowser] Bug report (Issue #3)

Hello again @StefanoOcchettihttps://github.com/StefanoOcchetti!

We'll have a look at your issue today. In the meatime, maybe you can confirm that you have set the correct permissions (Web server can write) on the folder that the FileBrowser will be using to upload the files.

Many thanks for reporting this, and we'll get back to you shortly once we successfully reproduce your issue.

Cheers!

— Reply to this email directly, view it on GitHubhttps://github.com/linuxforphp/filebrowser/issues/3#issuecomment-1136041804, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOJDJSPZ5I3PTN4KW64HDZLVLTVFLANCNFSM5WUZLOCQ. You are receiving this because you were mentioned.Message ID: @.***>


This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. They are confidential and may be subject to legal privilege. If you are not the intended recipient you should not peruse, disseminate, or distribute this message. If you have received this message in error please notify the sender immediately, destroy any copies taken and delete the original from your system. Computer viruses can be transmitted by email. Recipients should check this message for the presence of viruses. ORS srl and members of the ORS Group accept no liability for damage caused by any viruses transmitted by this email. This message represents the opinion of the sender and not necessarily the opinion of the company. Privacy policyhttps://ors.ai/index.php/privacy-policy/.

andrewscaya commented 1 year ago

Fixed with e00c12fa5e9a71479d718b3037626c0881d0e9f4 (Release-8.1.0).

FileBrowser now works with PHP 8.0-8.2 out of the box.

Thanks for reporting this, @StefanoOcchetti!