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

Bug report #3

Closed
StefanoOcchetti opened this issue May 23, 2022 · 8 comments
Closed

Bug report #3

StefanoOcchetti opened this issue May 23, 2022 · 8 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@StefanoOcchetti
Copy link

StefanoOcchetti commented May 23, 2022

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 .

  1. Run the image with:

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

  1. With a browser, access the file browser at: http://localhost:4000, username: admin; password: admin123
  2. Click on "Add files" and try to upload a file
  3. A red line appears on the bottom, and no file is uploaded
    image
  4. 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):

  • FileBrowser Version 8.0.2
  • Server: Ubuntu 22.04
  • PHP Version PHP 8.1.2 (cli) (built: Apr 7 2022 17:46:26) (NTS)
  • Browser Chrome
@andrewscaya
Copy link
Contributor

andrewscaya commented May 24, 2022

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!

@andrewscaya andrewscaya self-assigned this May 24, 2022
@andrewscaya andrewscaya added the help wanted Extra attention is needed label May 24, 2022
@StefanoOcchetti
Copy link
Author

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
Copy link
Contributor

@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
Copy link

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
Copy link
Author

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
Copy link
Contributor

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
Copy link
Author

StefanoOcchetti commented Oct 11, 2022 via email

@andrewscaya
Copy link
Contributor

andrewscaya commented May 4, 2023

Fixed with e00c12f (Release-8.1.0).

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

Thanks for reporting this, @StefanoOcchetti!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants