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

WP 6.2.2 error #184

Closed
1 task done
jperalesHogarth opened this issue May 30, 2023 · 3 comments · Fixed by #230
Closed
1 task done

WP 6.2.2 error #184

jperalesHogarth opened this issue May 30, 2023 · 3 comments · Fixed by #230
Assignees
Labels
help wanted type:bug Something isn’t working.
Milestone

Comments

@jperalesHogarth
Copy link

Describe the bug

Hello, thank you for this awesome plugin, I've found some issues with image uploading with this:

PHP: 8.2
WP: 6.2.2

I'm able to sync previous images with Azure, but can't add more images to Azure when I activate the Azure's plugin.

1172 line is about array_flip, but I'm pretty sure that the error is related with next line where blob returns an error.

I hope you can help me!

Steps to Reproduce

Try to upload a photo to media library. After configuration.

Screenshots, screen recording, code snippet

Stack trace:
#0 /home/ubuntu/environment/project/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php(1172): array_flip()
#1 /home/ubuntu/environment/project/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php(868): Windows_Azure_Rest_Api_Client->_sanitize_remote_paths()
#2 /home/ubuntu/environment/project/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-helper.php(449): Windows_Azure_Rest_Api_Client->sanitize_blobs_names()
#3 /home/ubuntu/environment/project/wp-content/plugins/windows-azure-storage/windows-azure-storage.php(614): Windows_Azure_Helper::get_unique_blob_name()
#4 /home/ubuntu/environment/project/wp-includes/class-wp-hook.php(308): windows_azure_storage_wp_handle_upload_prefilter()
#5 /home/ubuntu/environment/project/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#6 /home/ubuntu/environment/project/wp-admin/includes/file.php(810): apply_filters()
#7 /home/ubuntu/environment/project/wp-admin/includes/file.php(1082): _wp_handle_upload()
#8 /home/ubuntu/environment/project/wp-admin/includes/media.php(303): wp_handle_upload()
#9 /home/ubuntu/environment/project/wp-admin/includes/ajax-actions.php(2598): media_handle_upload()
#10 /home/ubuntu/environment/project/wp-admin/async-upload.php(33): wp_ajax_upload_attachment()
#11 {main}
thrown in /home/ubuntu/environment/project/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php on line 1172

Environment information

PHP: 8.2
WP: 6.2.2

WordPress information

6.2.2

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jperalesHogarth jperalesHogarth added the type:bug Something isn’t working. label May 30, 2023
@andreadistefano
Copy link

I think I found the same bug. Same versions of PHP and WP.
I am not sure as I can't find a way to get to the stack trace in the logs, but still the plugin is not uploading pictures to the storage.

@mayendrams
Copy link

PHP: 8.2.0
WP: 6.2.2

Same versions of PHP and WP. Running on local machine with azurite blob storage emulator.
Found the same issue.

Fatal error: Uncaught TypeError: array_flip(): Argument #1 ($array) must be of type array.

I think it is around $remote_paths = array_flip( $group_contents );
When I add condition to ignore that, the file seems successfully uploaded on the UI(because the url is generated on Media Library) but it never reached to blob storage and the filenames added randomly.
For example:
-64d0a85ca3319–64d0a85ca331flogo.png
URL : http://127.0.0.1:10000/devstoreaccount1/content/2023/08/:64d0a85ca3319-64d0a85ca331flogo.png.png

@jhessfaith
Copy link

if ( is_wp_error($group_contents) ){ echo $group_contents->get_error_message(); die; }
I added this above line 1172 in order to see what was causing this issue for me and got a result of forbidden.

If you trace the code back, it was coming from the call Windows_Azure_Helper::wp_upload_dir.

For me it turned out to be an authentication issue to the container. There was a misspelling in my account key.

@jeffpaul jeffpaul added this to the 4.5.0 milestone Jan 11, 2024
@jeffpaul jeffpaul moved this from Incoming to To Do in Open Source Practice Jan 11, 2024
@jeffpaul jeffpaul modified the milestones: 4.4.2, 4.5.0 May 6, 2024
@vikrampm1 vikrampm1 moved this from Incoming to Code Review in Open Source Practice May 28, 2024
@github-project-automation github-project-automation bot moved this from Code Review to Done in Open Source Practice Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted type:bug Something isn’t working.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants