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

Can't get list of files on directory with FTP adapter in PHP 8.3 #1761

Closed
lanz1 opened this issue Mar 6, 2024 · 3 comments
Closed

Can't get list of files on directory with FTP adapter in PHP 8.3 #1761

lanz1 opened this issue Mar 6, 2024 · 3 comments

Comments

@lanz1
Copy link

lanz1 commented Mar 6, 2024

Bug Report

Q A
Flysystem Version 3.23.1
Adapter Name FTP
Adapter version 3.23.1

Summary

Can't get list of files on directory with FTP adapter in PHP 8.3

League\Flysystem\UnableToListContents ─── vendor/league/flysystem/src/UnableToListContents.php:17
│ Unable to list contents for '/{directory}', shallow listing Reason: array_sum(): Addition is not supported on type string

How to reproduce

Laravel 11 + PHP 8.3

$driver = Storage::createFtpDriver([
'host' => value,
'port' => value,
'username' => value,
'password' => value,
'throw' => true,
]);

$driver->files('path');

Possible fix

Locally can be fixed by casting values in FtpAdapter.php row 488 as:

return array_sum(array_map(fn ($permission) => (int) $permission, str_split($part)));

@ixperiencenl
Copy link

Same issue here on L11 and PHP8.3.4
league/flysystem-ftp ^3.6

Thanks for your fix

@mpe85
Copy link

mpe85 commented May 15, 2024

@frankdejonge When will there be a release including this fix? Thank you

@frankdejonge
Copy link
Member

Sorry for the delay, 3.28.0 is out now.

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

No branches or pull requests

4 participants