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 error: Uncaught Error: Call to undefined function AMFUnsplash\add_query_args() #3

Closed
ntwb opened this issue Aug 31, 2021 · 2 comments · Fixed by #4
Closed

Fatal error: Uncaught Error: Call to undefined function AMFUnsplash\add_query_args() #3

ntwb opened this issue Aug 31, 2021 · 2 comments · Fixed by #4

Comments

@ntwb
Copy link
Member

ntwb commented Aug 31, 2021

I tried updating Altis Local Server using composer update -W

  • Upgrading humanmade/amf-wordpress (0.2.2 => 0.2.3)
  • Upgrading humanmade/asset-manager-framework (0.12.4 => 0.12.5)

Also confirmed AMF-Unsplash is using v0.2.0 based on changelog here 0.1.1...0.2.0

Reproduction Steps:

  • Update Altis Local Server v8 using composer update -W

  • Download this AMF Unsplash plugin and add to content/plugins (Also tried as an mu-plugin with same results)

  • Test Unsplash by searching for an image in the Unsplash library

  • Add an Unsplash image to a post

  • Switch the media library back to "Local Media"

  • No images appear, the spinner gif constantly spins

  • Expected to see the single image already in the local media library and the unsplash image used in the above post

Opening the Console the following isssue is observered:

  • XHR POST | /wp-admin/admin-ajax.php
  • 500 Internal Server Error
  • Referer | /wp-admin/upload.php

On the Console Response tab the following stack trace is shown:

Summary:

return add_query_args( urlencode_deep( $query_args ), $base_url );

Fatal error: Uncaught Error: Call to undefined function AMFUnsplash\add_query_args()
in /usr/src/app/content/plugins/amf-unsplash-master/inc/class-provider.php on line 358

Full Stack Trace:

Fatal error: Uncaught Error: Call to undefined function AMFUnsplash\add_query_args()
in /usr/src/app/content/mu-plugins/amf-unsplash-master/inc/class-provider.php on line 358

Call stack:

    AMFUnsplash\Provider::resize()
    vendor/humanmade/asset-manager-framework/inc/namespace.php:461
    AssetManagerFramework\dynamic_downsize()
    wp-includes/class-wp-hook.php:292
    WP_Hook::apply_filters()
    wp-includes/plugin.php:212
    apply_filters()
    wp-includes/media.php:4025
    wp_prepare_attachment_for_js()
    array_map()
    wp-admin/includes/ajax-actions.php:2993
    wp_ajax_query_attachments()
    vendor/humanmade/asset-manager-framework/inc/LocalProvider.php:24
    AssetManagerFramework\LocalProvider::request()
    vendor/humanmade/asset-manager-framework/inc/Provider.php:138
    AssetManagerFramework\Provider::request_items()
    vendor/humanmade/asset-manager-framework/inc/namespace.php:273
    AssetManagerFramework\ajax_query_attachments()
    wp-includes/class-wp-hook.php:292
    WP_Hook::apply_filters()
    wp-includes/class-wp-hook.php:316
    WP_Hook::do_action()
    wp-includes/plugin.php:484
    do_action()
    wp-admin/admin-ajax.php:187
@ntwb
Copy link
Member Author

ntwb commented Aug 31, 2021

Fix in #4 resolves the issue and the local media library now loads as expected with AMF Unsplash activated

image

@roborourke
Copy link
Contributor

Whoops. Think I wrote the code for the dynamic image sizing directly in the docs 😬 , thanks for the fix.

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

Successfully merging a pull request may close this issue.

2 participants