dxw / iguana

An extensible theme and plugin framework for WordPress.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Namespacing is not working properly

RobjS opened this issue · comments

@mallorydxw This came to my attention while working on a new dxw Extras module.

For example:

Create a new dxw Extras class that just contains the following method:

public function register() 
{
  wp_die();
}

Register the module in dxw Extras' di.php, but not anywhere else (i.e. the register() method should not be getting called).

Activate this version of dxw-extras on a site that also uses Iguana in its theme (e.g. the dxw website). The new module's register() method will be called. Switch to a theme that does not use Iguana, and the method does not get called.

Some initial testing suggests that a fix might be to change the register() method in Registrar.php to:

foreach ($this->di[$this->namespace] as $instance) {
    if ($instance instanceof \Dxw\Iguana\Registerable) {
        $instance->register();
    }
}

But it needs more investigation to be sure.

Yes, I imagine that would work. I'll make a ticket for this and I'll do some testing too.