WPIntell

Source evidence

Fatal error on uninstallation / SOLUTION

Cookie-Script.com · support · 2023-09-29T22:40:00+00:00

complaintsentiment
highseverity
1.0relevance
3replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

4 / 34 rows with source links

11.8% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

30 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
jamelescroc unresolved
[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 2 years, 8 months ago by jamelescroc . This topic was modified 2 years, 8 months ago by 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") ); 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 = "//cdn."; break; case 2: $conn = "//eu."; break; case 3: $conn = "//ca."; break; case 4: $conn = "//ca-eu."; break; } whit this public function cookie_script_generate_url() { $url = null; $conn = ""; switch ($this->item_connection_type) { case 1: $conn = "//cdn."; break; case 2: $conn = "//eu."; break; case 3: $conn = "//ca."; break; case 4: $conn = "//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.

Comments

3 shown
jamelescroc 2023-09-29T22:50:00+00:00

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") );

jamelescroc 2023-09-29T22:56:00+00:00

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

wrongchris 2024-01-02T21:28:00+00:00

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.