View Issue Details

IDProjectCategoryView StatusLast Update
0012620mantisbtplug-inspublic2014-12-08 00:33
Reportersveyret Assigned Todhx  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.3 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0012620: Plug-ins included through function
Description

Plug-ins are included by core.php through functions in plugin_api.php.
This can cause problems if the plug-in itself requires an api defining global variables. The variable will not have global scope unless defined explicitly.

This can cause hard-to-debug errors.

If there is no other way, I think we should explicitly define global variables, even if they seem to be by default defined outside any scope (example, adding a
global $g_custom_field_type_definition;
in custom_field_api, even if it seems that this variable should be at a global scope).

Steps To Reproduce
  1. Create a project with a custom field.
  2. Create and install a plug-in with a require_once "bug_api.php" at the top of the main file.
  3. Report a new issue.
    You should get a:
    APPLICATION ERROR 0001304 (ERROR_CUSTOM_FIELD_INVALID_DEFINITION)
Additional Information

Including bug_api indirectly includes the cfdefs files for custom field definitions, which should be stored in a global variable. But as this include is made through the main file of plug-in, itself included through a function, the variable will actually not have this global scope.

TagsNo tags attached.

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 

Activities

grangeway

grangeway

2012-03-04 10:12

reporter   ~0031377

This is fixed in our development branches - as we moved to using a 'require_api' function instead of require_once - and that tries to handle the global scope

grangeway

grangeway

2013-04-05 17:57

reporter   ~0036311

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch