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
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.