I'm getting the following errors on every page load after installing configuration module and xautoload.

Notice: Undefined index: theme_engine in Drupal\xautoload\Adapter\DrupalExtensionAdapter->registerExtensions() (line 116 of sites/all/modules/xautoload/lib/Adapter/DrupalExtensionAdapter.php).
Notice: Undefined index: theme_engine in Drupal\xautoload\Adapter\DrupalExtensionAdapter->registerExtensions() (line 121 of sites/all/modules/xautoload/lib/Adapter/DrupalExtensionAdapter.php).

Any ideas what could be causing this?

CommentFileSizeAuthor
#4 undefined-extension.patch946 bytessonictruth
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

donquixote’s picture

Seems this is a scenario i did not test and did not prepare for.
A Drupal "extension" can be a module or theme, but it can also be a theme engine, apparently. I assume you only get to deal with that if you actually have a theme engine installed other than what is there in Drupal by default.

There are two ways to fix this:
1. We agree that theme engines don't ever need special autoloading support, and skip this case.
2. We add some special logic for theme engines.

I strongly in favor of option 1, until someone actually makes a solid case why we need to support theme engines.
Supporting theme engines also would mean we need to have an equivalent for drupal_get_path('module', *).

Patch or PR will follow, stay tuned.

donquixote’s picture

I don't like to upload patches.
https://github.com/donquixote/drupal-xautoload/compare/7.x-4.x-2199913-t...

Can you try and report if it works?
And also let us know what is special about your install, if you really have an extra theme engine installed.

I would like to fix this asap.

sonictruth’s picture

That fixed it. We don't have any extra theme engines installed—we've only ever used phptemplate that comes with Drupal. The only probably interesting thing about this site is that it uses translation heavily.

Thanks for the quick fix though.

sonictruth’s picture

FileSize
946 bytes

Here's a patch if anyone else needs it

donquixote’s picture

I am going to commit this soon (next days).
But I would still like to know why this happens for some people (you) and not for others.
Can you get a backtrace?

sonictruth’s picture

Here's a backtrace from just before the fix you posted. I hope it helps. Note that I prepended the paths with *path_to_drupal* instead of the real path on my hdd.

array (size=12)
  0 => 
    array (size=7)
      'file' => string '*path_to_drupal*/sites/all/modules/xautoload/lib/Adapter/DrupalExtensionAdapter.php' (length=95)
      'line' => int 96
      'function' => string 'registerExtensions' (length=18)
      'class' => string 'Drupal\xautoload\Adapter\DrupalExtensionAdapter' (length=47)
      'object' => 
        object(Drupal\xautoload\Adapter\DrupalExtensionAdapter)[10]
          protected 'system' => 
            object(Drupal\xautoload\DrupalSystem\DrupalSystem)[3]
              ...
          protected 'finder' => 
            object(Drupal\xautoload\ClassFinder\ClassFinder)[17]
              ...
          protected 'namespaceBehaviors' => 
            array (size=2)
              ...
          protected 'prefixBehaviors' => 
            array (size=2)
              ...
          protected 'namespaceMap' => 
            object(Drupal\xautoload\ClassFinder\GenericPrefixMap)[15]
              ...
          protected 'prefixMap' => 
            object(Drupal\xautoload\ClassFinder\GenericPrefixMap)[16]
              ...
          protected 'registered' => 
            array (size=0)
              ...
          protected 'defaultBehavior' => 
            object(Drupal\xautoload\DirectoryBehavior\DefaultDirectoryBehavior)[31]
              ...
      'type' => string '->' (length=2)
      'args' => 
        array (size=1)
          0 => &
            array (size=184)
              ...
  1 => 
    array (size=7)
      'file' => string '*path_to_drupal*/sites/all/modules/xautoload/lib/FinderOperation/RegisterActiveExtensionsOperation.php' (length=114)
      'line' => int 11
      'function' => string 'registerActiveExtensions' (length=24)
      'class' => string 'Drupal\xautoload\Adapter\DrupalExtensionAdapter' (length=47)
      'object' => 
        object(Drupal\xautoload\Adapter\DrupalExtensionAdapter)[10]
          protected 'system' => 
            object(Drupal\xautoload\DrupalSystem\DrupalSystem)[3]
              ...
          protected 'finder' => 
            object(Drupal\xautoload\ClassFinder\ClassFinder)[17]
              ...
          protected 'namespaceBehaviors' => 
            array (size=2)
              ...
          protected 'prefixBehaviors' => 
            array (size=2)
              ...
          protected 'namespaceMap' => 
            object(Drupal\xautoload\ClassFinder\GenericPrefixMap)[15]
              ...
          protected 'prefixMap' => 
            object(Drupal\xautoload\ClassFinder\GenericPrefixMap)[16]
              ...
          protected 'registered' => 
            array (size=0)
              ...
          protected 'defaultBehavior' => 
            object(Drupal\xautoload\DirectoryBehavior\DefaultDirectoryBehavior)[31]
              ...
      'type' => string '->' (length=2)
      'args' => 
        array (size=0)
          empty
  2 => 
    array (size=7)
      'file' => string '*path_to_drupal*/sites/all/modules/xautoload/lib/ClassFinder/ProxyClassFinder.php' (length=93)
      'line' => int 73
      'function' => string 'operateOnFinder' (length=15)
      'class' => string 'Drupal\xautoload\FinderOperation\RegisterActiveExtensionsOperation' (length=66)
      'object' => 
        object(Drupal\xautoload\FinderOperation\RegisterActiveExtensionsOperation)[32]
      'type' => string '->' (length=2)
      'args' => 
        array (size=2)
          0 => 
            object(Drupal\xautoload\ClassFinder\ClassFinder)[17]
              ...
          1 => 
            object(Drupal\xautoload\Adapter\DrupalExtensionAdapter)[10]
              ...
  3 => 
    array (size=7)
      'file' => string '*path_to_drupal*/sites/all/modules/xautoload/xautoload.module' (length=73)
      'line' => int 192
      'function' => string 'onFinderInit' (length=12)
      'class' => string 'Drupal\xautoload\ClassFinder\ProxyClassFinder' (length=45)
      'object' => 
        object(Drupal\xautoload\ClassFinder\ProxyClassFinder)[11]
          protected 'finder' => 
            object(Drupal\xautoload\ClassFinder\ClassFinder)[17]
              ...
          protected 'helper' => 
            object(Drupal\xautoload\Adapter\DrupalExtensionAdapter)[10]
              ...
          protected 'scheduledOperations' => 
            array (size=0)
              ...
          protected 'initialized' => boolean true
      'type' => string '->' (length=2)
      'args' => 
        array (size=1)
          0 => 
            object(Drupal\xautoload\FinderOperation\RegisterActiveExtensionsOperation)[32]
              ...
  4 => 
    array (size=4)
      'file' => string '*path_to_drupal*/sites/all/modules/xautoload/xautoload.module' (length=73)
      'line' => int 17
      'function' => string '_xautoload_register_drupal' (length=26)
      'args' => 
        array (size=0)
          empty
  5 => 
    array (size=4)
      'file' => string '*path_to_drupal*/includes/bootstrap.inc' (length=51)
      'line' => int 1104
      'args' => 
        array (size=1)
          0 => string '*path_to_drupal*/sites/all/modules/xautoload/xautoload.module' (length=73)
      'function' => string 'include_once' (length=12)
  6 => 
    array (size=4)
      'file' => string '*path_to_drupal*/includes/module.inc' (length=48)
      'line' => int 24
      'function' => string 'drupal_load' (length=11)
      'args' => 
        array (size=2)
          0 => &string 'module' (length=6)
          1 => &string 'xautoload' (length=9)
  7 => 
    array (size=4)
      'file' => string '*path_to_drupal*/includes/bootstrap.inc' (length=51)
      'line' => int 2439
      'function' => string 'module_load_all' (length=15)
      'args' => 
        array (size=1)
          0 => &boolean true
  8 => 
    array (size=4)
      'file' => string '*path_to_drupal*/includes/bootstrap.inc' (length=51)
      'line' => int 2200
      'function' => string '_drupal_bootstrap_variables' (length=27)
      'args' => 
        array (size=0)
          empty
  9 => 
    array (size=4)
      'file' => string '*path_to_drupal*/includes/bootstrap.inc' (length=51)
      'line' => int 2334
      'function' => string 'drupal_bootstrap' (length=16)
      'args' => 
        array (size=2)
          0 => &int 3
          1 => &boolean false
  10 => 
    array (size=4)
      'file' => string '*path_to_drupal*/includes/bootstrap.inc' (length=51)
      'line' => int 2192
      'function' => string '_drupal_bootstrap_page_cache' (length=28)
      'args' => 
        array (size=0)
          empty
  11 => 
    array (size=4)
      'file' => string '*path_to_drupal*/index.php' (length=38)
      'line' => int 20
      'function' => string 'drupal_bootstrap' (length=16)
      'args' => 
        array (size=1)
          0 => &int 7
donquixote’s picture

Thanks.
What I can read from this is that it happens when it wants to register *all* currently active extensions.
And this means at least one theme engine is in the system table and marked as active.

sonictruth’s picture

Just looked in the system table and there is a theme_engine row for phptemplate. I also checked a fresh D7 and it doesn't have any theme_engine rows. The site in question was upgraded to D7 from D6. Is it possible that is a hang over from D6?

donquixote’s picture

Wow, yes, this could be the explanation.
Which still means I should merge the fix and release it. But at least now we know what we are doing and why :)

Thanks for the digging and reporting!

sonictruth’s picture

No problems, thanks for the quick fix.

donquixote’s picture

Status: Active » Fixed

Fixed in 7.x-4.2

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.