• This Plugin caused a Fatal Error on WordPress rendering the website unavailable. Deactivated your plugin (release 1.2.8) and the site became available again.

    A quick Google search revealed a number of instances of Fatal Errors with this plugin. Nothing specific to current release 1.2.8 – just a history o similar failures going back over a year or so.

    After a thorough check of the website, I attempted to start your plugin again. Following message received:

    Fatal error: Cannot declare class Logger, because the name is already in use in?/home/u661969485/domains/k9-catering.co.uk/public_html/wp-content/plugins/tiktok-for-business/logging/Logger.php?on line?18

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • cristianregistrodominios

    (@cristianregistrodominios)

    I have the same problem. Tiktok not responding

    cristianregistrodominios

    (@cristianregistrodominios)

    I found the problem. I summarize everything here:

    Problem Description:

    The issue on the website was caused by the TikTok for Business plugin, which wasn’t using namespaces in its code. This led to a conflict with other plugins that also implement a class called Logger.

    In programming, a namespace is a way to logically group classes and avoid name collisions. Many other plugins on the site (like Yoast SEO, UpdraftPlus, FluentForms, etc.) already use namespaces to prevent conflicts with classes that share the same name, but the TikTok plugin didn’t. As a result, when WordPress tried to load the Logger class, there was confusion about which one to use.

    How did we fix it?

    • We added a namespace to the TikTok plugin: To prevent conflicts, we modified the TikTok plugin’s Logger.php file by adding a specific namespace (TikTokForBusiness\Logging) that groups and distinguishes this Logger class from those in other plugins.

    The file now includes the following code:

    namespace TikTokForBusiness\Logging; class Logger { // class code }

    • We updated the files depending on Logger: Several other classes within the TikTok plugin that used the Logger class had to be adjusted to recognize the new namespace. This was done by modifying the constructors in those classes to expect the correct version of the Logger class.

    For example, the constructor of Tt4b_Mapi_Class was updated to use the full namespace:

    public function __construct(\TikTokForBusiness\Logging\Logger $logger) { $this->logger = $logger; }

    • Instantiating with the correct namespace: The main plugin file was also adjusted to ensure that the Logger instances passed to other classes were from the correct namespaced version. This prevented further type errors.

    $logger = new \TikTokForBusiness\Logging\Logger();

    Why was the error caused by TikTok?

    The conflict happened because the TikTok for Business plugin wasn’t using namespaces for its Logger class, which is a standard practice in most other plugins to avoid such issues. While plugins like Yoast SEO, UpdraftPlus, and FluentForms already employ namespaces to prevent name conflicts, TikTok had not implemented this yet, leading to the errors.

    What to keep in mind while waiting for an official update:

    • Compatibility: For now, we’ve fixed the issue by manually adding a namespace to the TikTok plugin. This should prevent further conflicts with other plugins using a Logger class.
    • Plugin Update: We should keep an eye on future updates to the TikTok for Business plugin, as the developers might fix this issue in a new release. Before applying the update, we recommend checking the release notes to confirm if they’ve addressed the namespace usage.
    • Reverting Changes: When the TikTok plugin team releases an official version with namespaces, we can revert the manual changes we’ve made.

    Recommendation:

    Monitor the TikTok plugin for updates, testing any new version in a staging environment before applying it in production to ensure the conflict has been officially resolved.

    I leave here the download link with the modified code:

    https://github.com/cristianguancha/tiktok

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin caused Fatal error on WordPress’ is closed to new replies.