1
andrey3761
Bug in xoops_getModuleOption()

I found an error in the function xoops_getModuleOption().
The module MYMODULE1 configuration is IMGDIR.
The module MYMODULE2 configuration is IMGDIR.
The names of the modules are the same configurations.
If both call functions
$conf1 = xoops_getModuleOption( 'IMGDIR', 'MYMODULE1' );
$conf2 = xoops_getModuleOption( 'IMGDIR', 'MYMODULE2' );
then the last call will return the configuration of the first module
I corrected this error. The code below:
function xoops_getModuleOption($option$dirname '')
{
    static 
$modOptions = array();
    if (
is_array($modOptions) && isset($modOptions[$dirname][$option])) {
        return 
$modOptions[$dirname][$option];
    }

    
$ret false;
    
$module_handler =& xoops_gethandler('module');
    
$module =& $module_handler->getByDirname($dirname);
    
$config_handler =& xoops_gethandler('config');
    if (
is_object($module)) {
        
$moduleConfig =& $config_handler->getConfigsByCat(0$module->getVar('mid'));
        if (isset(
$moduleConfig[$option])) {
            
$ret $moduleConfig[$option];
        }
    }
    
$modOptions[$dirname][$option] = $ret;
    return 
$ret;
}

2
Mamba
Re: Bug in xoops_getModuleOption()
  • 2014/1/13 21:12

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Thanks, Andrey. That's great!
Could you please submit it to SourceForge Bug Tracker, with the link to this thread?
Thanks!
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
andrey3761
Re: Bug in xoops_getModuleOption()

Hi Mamba!
I submit an bug report.
https://sourceforge.net/p/xoops/bugs/1291/

Login

Who's Online

219 user(s) are online (131 user(s) are browsing Support Forums)


Members: 0


Guests: 219


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits