View Issue Details

IDProjectCategoryView StatusLast Update
0010879mantisbtplug-inspublic2009-10-07 14:19
Reporterdhx Assigned Tojreese  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Target Version1.2.0rc2Fixed in Version1.2.0rc2 
Summary0010879: Cannot uninstall plugins: attempted use of undefined index within g_plugin_cache_protected
Description

This bug was introduced with http://git.mantisbt.org/?p=mantisbt.git;a=commitdiff;h=df475bdce50d5f5a2ab09c2b3514113de33a0310

Steps to reproduce:

  • Install Timecard plugin

  • Uninstall Timecard plugin

Error received:
Undefined index: Timecard
Full path: /var/www/localhost/htdocs/mantis-git/core/plugin_api.php
Line: 468
Variable Value Type
p_basename Timecard string

Backtrace:
/var/www/localhost/htdocs/mantis-git/core/plugin_api.php 628 - - plugin_protected ( <string>'Timecard' )
/var/www/localhost/htdocs/mantis-git/manage_plugin_uninstall.php 43 - - plugin_uninstall ( <Object><TimecardPlugin> ( [name] => 'Timecard', [description] => 'Time tracking for issues and projects in MantisBT.', [page] => 'config_page', [version] => '0.9.0', [requires] => <Array> { ['MantisCore'] => '1.2.0' }, [uses] => NULL, [author] => 'John Reese', [contact] => 'jreese@leetcode.net', [url] => 'http://leetcode.net', [basename] => 'Timecard' ) )

TagsNo tags attached.

Activities

dhx

dhx

2009-08-27 02:08

reporter   ~0022817

Last edited: 2009-08-27 02:10

manage_plugin_uninstall.php disables plugins, thus causing core.php to NOT call plugin_init_installed(). If plugin_init_installed() is not called, then plugin_register_installed() is also not called. The only place where $g_plugin_cache_priority and $g_plugin_cache_protected are updated is within plugin_register_installed().

Hence when plugin_protected() is called from within plugin_uninstall (where PLUGINS_DISABLED is defined as true) it'll attempt to access the non-existent $g_plugin_cache_protected cache.

Maybe it is best to introduce a new function that generates the $g_plugincache* variables? Or if we don't mind the extra query, split it into plugin_cache_protected() and plugin_cache_priority(). These functions can then be called from within plugin_priorty() and plugin_protected() if the cache is null.

Thus the requirement on calling plugin_register_installed() is removed completely. This sounds useful to me as there are times when you may want to know if a plugin is protected (or what the priority is) without actually registering it.

jreese

jreese

2009-09-04 12:03

reporter   ~0022877

Fix committed to 1.2.x and master branches.

Related Changesets

MantisBT: master-1.2.x 0430df5d

2009-09-04 12:00

jreese


Details Diff
Fix 0010879: Pre-register plugins at uninstall time Affected Issues
0010879
mod - manage_plugin_uninstall.php Diff File

MantisBT: master 82873626

2009-09-04 12:00

jreese


Details Diff
Fix 0010879: Pre-register plugins at uninstall time Affected Issues
0010879
mod - manage_plugin_uninstall.php Diff File