• [29-Sep-2023 22:35:37 UTC] PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, non-static method CookieScript::cookie_script_deactivation() cannot be called statically in /home/intellis/xxxxxxx.com/wp-includes/class-wp-hook.php:310
    Stack trace: 0 /home/intellis/xxxxxx.com/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(”, Array) 1 /home/intellis/xxxxxx.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array) 2 /home/intellis/xxxxxx.com/wp-admin/includes/plugin.php(816): do_action(‘deactivate_cook…’, false) 3 /home/intellis/xxxxxx.com/wp-admin/plugins.php(209): deactivate_plugins(‘cookie-script-c…’, false, false) 4 {main}

    thrown in /home/intellis/xxxxxxx.com/wp-includes/class-wp-hook.php on line 310

    • This topic was modified 1 year, 1 month ago by jamelescroc.
    • This topic was modified 1 year, 1 month ago by jamelescroc.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jamelescroc

    (@jamelescroc)

    solution : edit file cookie-script.php and replace : line 418 to 449 .

    replace that :

    public function cookie_script_deactivation() {
            wp_dequeue_script("cookie_script");
        }
    
        // Clean up DB after uninstalling plugin
        public function cookie_script_uninstall() {
    
            if (!current_user_can("activate_plugins")) {
                return null;
            }
    
            delete_option("cookie_script_item_id");
            delete_option("cookie_script_item_src");
            delete_option("cookie_script_item_connection_type");
            delete_option("cookie_script_location");
            delete_option("cookie_script_location_in_element");
    
            wp_dequeue_script("cookie_script");
            wp_deregister_script("cookie_script");
    
        }
    
    }
    
    new CookieScript();
    
    // Make sure there is no cookie script in document while plugin is deactivated
    register_deactivation_hook( __FILE__, array("CookieScript", "cookie_script_deactivation") );
    
    // Clean up DB after uninstalling plugin
    register_uninstall_hook( __FILE__, array("CookieScript", "cookie_script_uninstall") );
    

    ………………………………………………………………………

    per that

        public static function cookie_script_deactivation() {
        wp_dequeue_script("cookie_script");
    }
    
    // Clean up DB after uninstalling plugin
    public static function cookie_script_uninstall() {
    
        if (!current_user_can("activate_plugins")) {
            return null;
        }
    
        delete_option("cookie_script_item_id");
        delete_option("cookie_script_item_src");
        delete_option("cookie_script_item_connection_type");
        delete_option("cookie_script_location");
        delete_option("cookie_script_location_in_element");
    
        wp_dequeue_script("cookie_script");
        wp_deregister_script("cookie_script");
    
    }
    
    }
    
    $new_instance = new CookieScript();
    
    // Make sure there is no cookie script in document while plugin is deactivated
    register_deactivation_hook( __FILE__, array($new_instance, "cookie_script_deactivation") );
    
    // Clean up DB after uninstalling plugin
    register_uninstall_hook( __FILE__, array($new_instance, "cookie_script_uninstall") );
    Thread Starter jamelescroc

    (@jamelescroc)

    and if you got a lot of php warning message like this : [29-Sep-2023 18:58:51 UTC] PHP Warning: Undefined variable $conn in /home/intellis/xxxxxxx.com/wp-content/plugins/cookie-script-com/cookie-script.php on line 395

    edit file cookie-script.php line 378 to 394

    and replace this

    public function cookie_script_generate_url() {
    
    
        $url = null;
    
        switch ($this->item_connection_type) {
            case 1:
                $conn = "https://cdn.";
                break;
            case 2:
                $conn = "https://eu.";
                break;
            case 3:
                $conn = "https://ca.";
                break;
            case 4:
                $conn = "https://ca-eu.";
                break;
        }

    whit this

       public function cookie_script_generate_url() {
    
        $url = null;
        $conn = "";
    
        switch ($this->item_connection_type) {
            case 1:
                $conn = "https://cdn.";
                break;
            case 2:
                $conn = "https://eu.";
                break;
            case 3:
                $conn = "https://ca.";
                break;
            case 4:
                $conn = "https://ca-eu.";
                break;
            default:
                $conn = "";
                break;
        }

    Thank you!! Thanks to the first code, I managed to deactivate the plugin, and thanks to the second one, I was able to delete it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal error on uninstallation / SOLUTION’ is closed to new replies.