• Resolved andrewinsideout

    (@andrewinsideout)


    Fatal error: Class ‘PicaticAPI’ not found in /…/wp/wp-content/plugins/picatic/picatic-lib.php on line 135

    This is from a fresh install of wordpress and the Picatic plugin.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author picatic

    (@picatic)

    @andrewinsideout, are you working on this in a localhost environment?

    The problem appears to be that the vendor library that communicates with our API is not loading. We use composer to load the vendor libraries and there are occasionally issues around doing this when working in localhost.

    Which screen are you on (what are you doing) when you see this error.

    Thread Starter andrewinsideout

    (@andrewinsideout)

    I’m not working locally. This error is happening when I try to use the shortcode “[picatic-upcoming-events][/picatic-upcoming-events]”.

    Plugin Author picatic

    (@picatic)

    @andrewinsideout, we’re having difficulty reproducing the error. Would you be able to supply us with more details?

    • What screen do you see the error on, the edit page, or the public page?
    • What host are you using? What server environment are you running (LAMP?)? What version of PHP?
    Thread Starter andrewinsideout

    (@andrewinsideout)

    Running LAMP with WordPress 4.8. PHP 5.6.30. The backend of the plugin works well, I receive the fatal error on the front end of the site.

    I’ve checked the file /plugins/picatic/vendor/picatic/php-api/src/PicaticAPI.php and the file is there with the correct permissions.

    Thread Starter andrewinsideout

    (@andrewinsideout)

    If it helps I hacked it to work by adding this code to the top of picatic-lib.php

    
    if(!function_exists('http_build_url'))
            include_once(__DIR__.'/vendor/jakeasmith/http_build_url/src/http_build_url.php');
    if(!class_exists('Picatic_Consumer_Interface'))
            include_once(__DIR__.'/vendor/picatic/php-api/src/Picatic_Consumer_Interface.php');
    if(!class_exists('Picatic_Requestor_Interface'))
            include_once(__DIR__.'/vendor/picatic/php-api/src/Picatic_Requestor_Interface.php');
    if(!class_exists('Picatic_Requestor'))
            include_once(__DIR__.'/vendor/picatic/php-api/src/Picatic_Requestor.php');
    if(!class_exists('PicaticAPI'))
            include_once(__DIR__.'/vendor/picatic/php-api/src/PicaticAPI.php');
    
    Plugin Author picatic

    (@picatic)

    Hey @andrewinsideout, sorry for the delay in replying.
    The above makes sense that it would work. I’m thinking that the problem is that in the picatic.php file on line 42, we include “vendor/autoload.php”. I’m guessing that because of the lack of __DIR__ in front of the path, it is having difficulty finding the file to load vendor dependencies.

    Would it be possible for you to check to see if this fix would work instead of what you implemented?

    So, remove the code you added above and try this instead in picatic.php line 42:
    `include(plugin_dir_path( __FILE__ ) . ‘vendor/autoload.php’);

    Thanks

    • This reply was modified 7 years, 4 months ago by picatic.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal Error— Plugin broken’ is closed to new replies.