We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Bug: get_plugins fatal error

Developer Preview

Dom Stubbs's avatar
Dom Stubbs
156 posts
14 years ago
Dom Stubbs's avatar Dom Stubbs

I’ve had a few bug reports for one of my addons which I’ve managed to pin down to the get_plugins function and a bit of user error. If a plugin is placed in the /plugins directory and the /third_party directory, calls to get_plugins result in a fatal error and a white screen of doom.

Clearly people most definitely should not be placing plugins in the /plugins folder, let alone the /plugins folder and the /third_party folder, but it seems to happen from time to time and I’d very much like my addon to stop breaking when it does.

The following change seems to do the trick. At around line 169 (in the June 14 2.2 release):

elseif (strncasecmp($file, 'pi.', 3) == 0 && 
        substr($file, -$ext_len) == '.php' && 
        strlen($file) > strlen('pi..php'))
{                            
    if ( ! @include_once(PATH_THIRD.$pkg_name.'/'.$file))
    {
        continue;
    }

    $plugins[] = $pkg_name;

    $info[$pkg_name] = array_unique($plugin_info);
}

Throw in a a class_exists check…

elseif (strncasecmp($file, 'pi.', 3) == 0 && 
        substr($file, -$ext_len) == '.php' && 
        strlen($file) > strlen('pi..php'))
{
    if ( ! class_exists(ucfirst($pkg_name)))
    {                            
        if ( ! @include_once(PATH_THIRD.$pkg_name.'/'.$file))
        {
            continue;
        }
    }

    $plugins[] = $pkg_name;

    $info[$pkg_name] = array_unique($plugin_info);
}

It’d be great if this could be included in a future release.

Thanks, Dom

       
Greg Aker's avatar
Greg Aker
6,022 posts
14 years ago
Greg Aker's avatar Greg Aker

Thanks Dom. we’re pushing a new build now, but will look at it bright and early on Monday.

-ga

       
Greg Aker's avatar
Greg Aker
6,022 posts
14 years ago
Greg Aker's avatar Greg Aker

And to close the loop here, got your suggested change committed for the next release. Thanks!

-ga

       
Dom Stubbs's avatar
Dom Stubbs
156 posts
14 years ago
Dom Stubbs's avatar Dom Stubbs

Fantastic, thanks Greg.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.