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

Fatal errors when using S3_UPLOADS_USE_LOCAL=true #532

Open
scraddle opened this issue Jun 24, 2021 · 1 comment
Open

Fatal errors when using S3_UPLOADS_USE_LOCAL=true #532

scraddle opened this issue Jun 24, 2021 · 1 comment

Comments

@scraddle
Copy link

Hi,

I tried to use the offline development feature S3_UPLOADS_USE_LOCAL.
Sadly when defining S3_UPLOADS_USE_LOCAL=true I get fatal errors when uploading an image in WP media library.
(I had to fix the loading of the local stream wrapper to use the "new" namespaces first).

"NOTICE: PHP message: PHP Warning: opendir(/var/www/public/app/uploads/s3/img.utopia.org/uploads/2021/06/flower-1669899_1920*): failed to open dir: No such file or directory in /var/www/public/app/plugins/s3-uploads/inc/class-local-stream-wrapper.php on line 515" "NOTICE: PHP message: PHP Warning: scandir(s3://img.utopia.org/uploads/2021/06/flower-1669899_1920*): failed to open dir: "\S3_Uploads\Local_Stream_Wrapper::dir_opendir" call failed in /var/www/public/app/plugins/s3-uploads/inc/class-plugin.php on line 668" "NOTICE: PHP message: PHP Warning: scandir(): (errno 13): Permission denied in /var/www/public/app/plugins/s3-uploads/inc/class-plugin.php on line 668" "NOTICE: PHP message: PHP Fatal error: Uncaught TypeError: Return value of S3_Uploads\Plugin::get_files_for_unique_filename_file_list() must be of the type array, bool returned in /var/www/public/app/plugins/s3-uploads/inc/class-plugin.php:668" "Stack trace:" "#0 /var/www/public/wp/wp-includes/class-wp-hook.php(292): S3_Uploads\Plugin->get_files_for_unique_filename_file_list()" "#1 /var/www/public/wp/wp-includes/plugin.php(212): WP_Hook->apply_filters()" "#2 /var/www/public/wp/wp-includes/functions.php(2560): apply_filters()" "#3 /var/www/public/wp/wp-admin/includes/file.php(908): wp_unique_filename()" "#4 /var/www/public/wp/wp-admin/includes/file.php(1020): _wp_handle_upload()" "#5 /var/www/public/wp/wp-admin/includes/media.php(303): wp_handle_upload()" "#6 /var/www/public/wp/wp-admin/includes/ajax-actions.php(2549): media_handle_upload()" "#7 /var/www/public/wp/wp-admin/async-upload.php(33): wp_ajax_upload_attachment()" "#8 {main}" " thrown in /var/www/public/app/plugins/s3-uploads/inc/class-plugin.php on line 668"
I'll send in a pull request with my solution shortly.

Thanks in advance!

@pentatonicfunk
Copy link

i can confirm same issue with 3.0.3 release https://github.com/humanmade/S3-Uploads/releases/tag/3.0.3

PHP Warning:  opendir(/var/web/site/public_html/wp-content/uploads/s3/todo/uploads/2021/10/ihkhc17wwft71*): failed to open dir: No such file or directory in /var/web/site/public_html/wp-content/plugins/manual-install-4/inc/class-local-stream-wrapper.php on line 516
[28-Oct-2021 14:45:25 UTC] PHP Warning:  scandir(s3://todo/uploads/2021/10/ihkhc17wwft71*): failed to open dir: "S3_Uploads\Local_Stream_Wrapper::dir_opendir" call failed in /var/web/site/public_html/wp-content/plugins/manual-install-4/inc/class-plugin.php on line 670
[28-Oct-2021 14:45:25 UTC] PHP Warning:  scandir(): (errno 2): No such file or directory in /var/web/site/public_html/wp-content/plugins/manual-install-4/inc/class-plugin.php on line 670
[28-Oct-2021 14:45:25 UTC] PHP Fatal error:  Uncaught TypeError: Return value of S3_Uploads\Plugin::get_files_for_unique_filename_file_list() must be of the type array, bool returned in /var/web/site/public_html/wp-content/plugins/manual-install-4/inc/class-plugin.php:670
Stack trace:
#0 /var/web/site/public_html/wp-includes/class-wp-hook.php(303): S3_Uploads\Plugin->get_files_for_unique_filename_file_list(NULL, 's3://todo/uploa...', 'ihkhc17wwft71.j...')
#1 /var/web/site/public_html/wp-includes/plugin.php(189): WP_Hook->apply_filters(NULL, Array)
#2 /var/web/site/public_html/wp-includes/functions.php(2586): apply_filters('pre_wp_unique_f...', NULL, 's3://todo/uploa...', 'ihkhc17wwft71.j...')
#3 /var/web/site/public_html/wp-admin/includes/file.php(924): wp_unique_filename('s3://todo/uploa...', 'ihkhc17wwft71.j...', NULL)
#4 /var/web/site/public_html/wp-admin/includes/file.php(1037): _wp_handle_upload(Array, Array, '2021-10-28 14:4...', 'wp_handle_uploa...')
#5 /var/web/site/public_html/wp-admin/includes/media.php(303): wp_handle_upload(Array, Array, '20 in /var/web/site/public_html/wp-content/plugins/manual-install-4/inc/class-plugin.php on line 670

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

2 participants