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

PHP 8+ error in isBinary() method when trying to open a resource in the bucket that is not accessible #26

Open
garryn opened this issue Mar 17, 2023 · 0 comments
Labels

Comments

@garryn
Copy link
Member

garryn commented Mar 17, 2023

Found a problem on a MODX Cloud site today that was using PHP 8.1 related to binary resources and the resource in question not having the ACLs required to be accessed.

The problem is in core/components/awss3mediasource/model/awss3mediasource/awss3mediasource.class.php on line 341.

The error suppression on the fread no longer works in PHP 8+ and will cause a fatal PHP error that stops any of the resources loading in the Media Source view in the Manager when the file being processed returns false from the fopen - for example, a 403 Forbidden response.

My fix was to add an explicit check right after the fopen:

if ($fh == false) { return false;}

That way, processing continues and valid resources will still be able to be displayed.

@garryn garryn added the bug label Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant