• Resolved Michelle Blanchette

    (@michelleblanchette)


    Hey @shortpixel,

    I’m trying to uninstall this plugin and the uninstallation script is failing.

    Here is the error log:

    
    PHP Fatal error:  Uncaught TypeError: call_user_func_array(): Argument #1 ($function) must be a valid callback, function "emr_uninstall" not found or invalid function name in /var/www/html/wp-includes/class-wp-hook.php:292
    Stack trace:
    #0 /var/www/html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()
    #1 /var/www/html/wp-includes/plugin.php(484): WP_Hook->do_action()
    #2 /var/www/html/wp-admin/includes/plugin.php(1286): do_action()
    #3 /var/www/html/wp-admin/includes/plugin.php(967): uninstall_plugin()
    #4 /var/www/html/wp-admin/includes/ajax-actions.php(4581): delete_plugins()
    #5 /var/www/html/wp-includes/class-wp-hook.php(292): wp_ajax_delete_plugin()
    #6 /var/www/html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()
    #7 /var/www/html/wp-includes/plugin.php(484): WP_Hook->do_action()
    #8 /var/www/html/wp-admin/admin-ajax.php(187): do_action()
    #9 {main}
      thrown in /var/www/html/wp-includes/class-wp-hook.php on line 292
    

    Could you please resolve this?

    Thank you!

    Michelle

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Gerard Blanco

    (@sixaxis)

    Hi Michelle,

    Perhaps the plugin wasn’t installed properly in first place. Could you please remove all the files from your file system? The path is /wp-content/plugins/enable-media-replace.

    Let me know if that works.

    Best,

    Thread Starter Michelle Blanchette

    (@michelleblanchette)

    Hi Gerard,

    I removed the plugin files from my server, re-installed the plugin, and the uninstallation script still failed.

    I’ve edited the code and resolved the issue. Could you please make sure this fix is implemented into the plugin? I found that the plugin uses a namespace, yet does not properly refer to this namespace when registering the uninstall function.

    Current, broken code in main plugin file:

    register_uninstall_hook(__FILE__, 'emr_uninstall');
    
    function emr_uninstall()
    {
            delete_option('enable_media_replace');
    }

    Fixed, working code:

    register_uninstall_hook(__FILE__, '\EnableMediaReplace\emr_uninstall');
    
    function emr_uninstall()
    {
            delete_option('enable_media_replace');
    }

    I’ve successfully uninstalled the plugin after making this change to the plugin.

    Could this please be implemented so plugin uninstallation is possible for others?

    Thank you!

    Michelle

    Plugin Support Gerard Blanco

    (@sixaxis)

    Hi Michelle!

    I actually had no issues uninstalling the plugin, and to be honest it is the first time we hear about something like this.

    Could you perhaps go to Tools > Site Health > Info and copy all the information from there and paste it here? I’m thinking there should be something very specific to your environment preventing the uninstallation from working.

    Thank you!

    Thread Starter Michelle Blanchette

    (@michelleblanchette)

    Hi Gerard,

    Providing my entire Site Health info is certainly overkill for a simple PHP namespacing issue.

    However, I can tell you that I just tested installing and uninstalling Enable Media Replace on a clean PHP 7.4 environment and experienced no issues.

    The environment that I experienced the issue on was running PHP 8. I then tested installation and uninstallation on a different PHP 8 environment. It had the same issue.

    Please try testing the plugin uninstallation and namespace fix on an environment running PHP 8 and let me know what you find.

    Cheers!

    Michelle

    Plugin Support Gerard Blanco

    (@sixaxis)

    Thank you, Michelle.

    We ask for the Site Health info precisely to know more about your server set up, but luckily you have already spotted the cause ??

    I’ve been able to reproduce it, so I’ll forward this to our developer team and once it’s fixed we’ll let you know.

    Thank you!

    Any update on this issue? I have the same problem on Version 3.5.0 on a PHP 8.x

    Plugin Support Gerard Blanco

    (@sixaxis)

    Hi @ipajen,

    We are still working on it, although there is no ETA. As soon as we have any news we will update this thread ??

    Thanks for your patience!

    Plugin Author Pedro

    (@petredobrescu)

    Hello @ipajen and @michelleblanchette and thanks for reporting this.

    The necessary fix will come in version 3.6.0, due to be released hopefully next week.

    Many thanks for your patience with this!
    Pedro

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Uninstall includes invalid function’ is closed to new replies.