Notice: Undefined index: theme_key in omega_extensions() (line 152 of /home/e-smith/files/ibays/sota4/html/sites/all/themes/omega/omega/includes/omega.inc).
Notice: Undefined index: theme_key in omega_discovery() (line 531 of /home/e-smith/files/ibays/sota4/html/sites/all/themes/omega/omega/includes/omega.inc).
Notice: Undefined index: theme_key in omega_theme_trail() (line 72 of /home/e-smith/files/ibays/sota4/html/sites/all/themes/omega/omega/includes/omega.inc).
Notice: Undefined index: in omega_theme_trail() (line 90 of /home/e-smith/files/ibays/sota4/html/sites/all/themes/omega/omega/includes/omega.inc).
Notice: Trying to get property of non-object in omega_theme_trail() (line 90 of /home/e-smith/files/ibays/sota4/html/sites/all/themes/omega/omega/includes/omega.inc).

I am not a coder so not sure why there are errors. But this only occurs when xautoload is enabled.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

donquixote’s picture

I can't reproduce this, sorry..
Can you explain what exactly to do to reproduce?

And, can you give me a stack trace?

  1. Install devel module.
    Make sure you are visiting the site as an admin with the "access developer information" permission enabled.
  2. Edit the function omega_extensions() in sites/all/themes/omega/omega/includes/omega.inc.
    function omega_extensions($theme = NULL, $reset = FALSE) {
      // Insert these 3 lines.
      if (!isset($theme) && !isset($GLOBALS['theme_key'])) {
        dpm(ddebug_backtrace(TRUE));
      }
      $theme = isset($theme) ? $theme : $GLOBALS['theme_key'];
    
  3. Visit again the page where this was happening. There should be a stack trace reported in the message area.
P2790’s picture

Status: Active » Postponed (maintainer needs more info)

Hi, thanks for the reply, I've removed xautoload but I will try it out again and post back the debug info

joelpittet’s picture

Got this two after some weird bug happened. So thought I'd share my traceback.

array (size=17)
  '16: omega_extensions()' => 
    array (size=2)
      'file' => string 'sites/all/themes/omega/omega/includes/omega.inc:154' (length=51)
      'args' => 
        array (size=0)
          empty
  '15: include_once()' => 
    array (size=2)
      'file' => string 'sites/all/themes/omega/omega/template.php:12' (length=44)
      'args' => 
        array (size=1)
          0 => string '/sites/all/themes/omega/omega/template.php' (length=83)
  '14: libraries_info()' => 
    array (size=2)
      'file' => string 'sites/all/modules/contrib/libraries/libraries.module:369' (length=56)
      'args' => 
        array (size=0)
          empty
  '13: libraries_xautoload()' => 
    array (size=2)
      'file' => string 'sites/all/modules/contrib/xautoload/xautoload.module:211' (length=56)
      'args' => 
        array (size=1)
          0 => 
            object(xautoload_InjectedAPI_hookXautoload)[255]
              ...
  '12: xautoload_BootSchedule_Helper_Base->invokeRegistrationHook()' => 
    array (size=2)
      'file' => string 'sites/all/modules/contrib/xautoload/lib/BootSchedule/Helper/Base.php:34' (length=71)
      'args' => 
        array (size=1)
          0 => &string 'xautoload' (length=9)
  '11: xautoload_BootSchedule_Default->initMainPhase()' => 
    array (size=2)
      'file' => string 'sites/all/modules/contrib/xautoload/lib/BootSchedule/Default.php:38' (length=67)
      'args' => 
        array (size=0)
          empty
  '10: call_user_func_array()' => 
    array (size=1)
      'args' => 
        array (size=2)
          0 => &
            array (size=2)
              ...
          1 => &
            array (size=0)
              ...
  ' 9: xautoload_Container_ProxyObject->proxyScheduleOperation()' => 
    array (size=2)
      'file' => string 'sites/all/modules/contrib/xautoload/lib/Container/ProxyObject.php:37' (length=68)
      'args' => 
        array (size=1)
          0 => &string 'initMainPhase' (length=13)
  ' 8: xautoload_BootSchedule_Proxy->initMainPhase()' => 
    array (size=2)
      'file' => string 'sites/all/modules/contrib/xautoload/lib/BootSchedule/Proxy.php:18' (length=65)
      'args' => 
        array (size=0)
          empty
  ' 7: xautoload_custom_theme()' => 
    array (size=2)
      'file' => string 'sites/all/modules/contrib/xautoload/xautoload.module:39' (length=55)
      'args' => 
        array (size=0)
          empty
  ' 6: call_user_func_array()' => 
    array (size=1)
      'args' => 
        array (size=2)
          0 => &string 'xautoload_custom_theme' (length=22)
          1 => &
            array (size=0)
              ...
  ' 5: module_invoke_all()' => 
    array (size=2)
      'file' => string 'includes/module.inc:895' (length=23)
      'args' => 
        array (size=1)
          0 => &string 'custom_theme' (length=12)
  ' 4: menu_get_custom_theme()' => 
    array (size=2)
      'file' => string 'includes/menu.inc:1748' (length=22)
      'args' => 
        array (size=1)
          0 => &boolean true
  ' 3: menu_set_custom_theme()' => 
    array (size=2)
      'file' => string 'includes/menu.inc:1770' (length=22)
      'args' => 
        array (size=0)
          empty
  ' 2: _drupal_bootstrap_full()' => 
    array (size=2)
      'file' => string 'includes/common.inc:5156' (length=24)
      'args' => 
        array (size=0)
          empty
  ' 1: drupal_bootstrap()' => 
    array (size=2)
      'file' => string 'includes/bootstrap.inc:2260' (length=27)
      'args' => 
        array (size=1)
          0 => &int 7
  ' 0: main()' => 
    array (size=2)
      'file' => string 'index.php:20' (length=12)
      'args' => 
        array (size=1)
          'q' => string 'admin/appearance' (length=16)
donquixote’s picture

@joelpittet:
This looks like you are using a very vintage version of xautoload.
I also think you are using an older version of libraries module.
But either way, this backtrace is gold!
But if you can tell me the exact version of libraries and xautoload, that would be even better.

It looks like libraries_info() is causing premature inclusion of omega/template.php, which has some ugly side effects.
Solution 1: Stop calling libraries_info() so early, and only call it from hook_init().
Solution 2: Use a newer version of libraries module, where this no longer happens.

Explanation:
We want to all the xautoload initialization stuff as early as possible, so that classes are available when they are needed.
There are different system events that trigger stuff in xautoload:

  • inclusion of the *.module file.
  • xautoload_boot().
  • xautoload_custom_theme() - which happens BEFORE xautoload_init().
  • xautoload_init().
  • some other events related to modules being enabled.

The exact mechanics have changed between xautoload versions, in an attempt to be less confusing - so I won't go into too much detail.
I should also add that a lot of things only happen after a cache miss, that is, if one class is not found.

xautoload does the following things based on these events:

  1. Register the default namespaces / prefixes for Drupal modules (PSR-0, PSR-4, PEAR-FLAT).
    This can happen as soon as Drupal is ready to provide a module list, and has no relevant side effects.
  2. Call hook_xautoload() on all modules.
    This can happen as soon as all *.module files (bootstrap and non-bootstrap modules) are included. So it can in fact happen in hook_custom_theme().
    Modules that implement hook_xautoload() should simply be careful.
  3. Call libraries_xautoload() as part of hook_xautoload(), which then calls libraries_info().
    Problem: libraries_info(), and maybe a number of hook_libraries_info() implementations, can have side effects that make it problematic to be called too early in the request().
    It seems that hook_custom_theme() is too early. hook_init() should work ok.

In fact the problem of calling libraries_info() from hook_custom_theme() is still in the latest version, so I'd say this should be fixed.
But I would still like to have the exact version of libraries, so I can try to reproduce.

joelpittet’s picture

I think I turned on crumbs to try it out vs path_breadcrumbs, then it enabled xautoload at the same time because it seemed to be the only module I was playing with and only one that required xautoload.

Also I think a team member force reverted the git repo to a much older version by accident which may be why I have an older version there. (All kinds of crap went down tonight, thank god for db backups).

It says xautoload is 7.x-3.6 which isn't that old (2014-Feb-07) but still not sure how I got it...

Thanks for the speedy response @donquixote!

I think a lot of issues I've been having lately have been cache miss related. Redis was my friend for a while, now it's not so much:S

donquixote’s picture

I think I turned on crumbs to try it out vs path_breadcrumbs, then it enabled xautoload at the same time.

Crumbs does not require xautoload. It is happy if it finds xautoload, but it has its own fallback class loader.

crumbs_example does require xautoload.
But there is no good reason to enable crumbs_example. Maybe I should make that more clear in the module description.

It says xautoload is 7.x-3.6 which isn't that old

Ok :) Still before 7.x4.x.
Which version is libraries?

And let me know how you get along with Crumbs :)

joelpittet’s picture

I don't recall enabling that crumbs example, explicitly recall not enabling it so no idea what xautoload came from because crumbs_example seems to be the only dependency I have installed.

Libraries is at 7.x-2.2

Crumbs looks pretty cool, but sounds too magical from the description. It may be the best solution yet, but I didn't get much of a chance to try it out before my staging site imploded.

I'm trying to just turn on breadcrumbs for products because of the taxonomy hierarchy depth. But the requirement is that only the leaf terms are clickable links (not the parents), though the parents need to be shown as well as the product display node title. I've got that more or less working in path_breadcrumbs but gotta figure out still how to turn it off for other paths. Not sure yet if crumbs can be up to the task to do that yet?

donquixote’s picture

https://github.com/donquixote/drupal-xautoload/compare/7.x-5.x-2234647-7...

This should fix the problem which occurs with older versions of libraries.

donquixote’s picture

Status: Postponed (maintainer needs more info) » Needs review

If you use a more recent version of libraries, you probably don't need this, but it could still save you from some side effects of other hook_libraries_info() implementations.

donquixote’s picture

Version: 7.x-4.5 » 7.x-5.x-dev

#8 applies to is 7.x-5.x.

I'm trying to just turn on breadcrumbs for products because of the taxonomy hierarchy depth. But the requirement is that only the leaf terms are clickable links (not the parents), though the parents need to be shown as well as the product display node title. I've got that more or less working in path_breadcrumbs but gotta figure out still how to turn it off for other paths. Not sure yet if crumbs can be up to the task to do that yet?

Sounds like something non-standard. Can you post an issue in Crumbs? Or talk to me on IRC.
Even if this turns out to be not possible yet, it is always interesting to know real-world use cases.

Status: Needs review » Needs work

The last submitted patch, 8: xautoload-7.x-5.x-2234647-7-preMainPhase.patch, failed testing.

donquixote’s picture

Status: Needs work » Needs review
donquixote’s picture

The latest 7.x-5.x should fix all of this. Can you try?

donquixote’s picture

Status: Needs review » Fixed

Supposedly fixed in 7.x-5.x.
Please reopen if not.

Status: Fixed » Closed (fixed)

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

BillyTom’s picture

I am using 7.x-5.1 from 2014-Nov-20 and I get this notice after I clear the cache. It does not show up on subsequent page views.

If I read this correctly then should #8 not already be included in 7.x-5.1?

GuyPaddock’s picture

Sorry to necro this, but I just ran into this issue on X Autoload 7.x-5.7 with Libraries 7.x-2.3 and Omega 7.x-4.4.

As we've had this combination in our install profile for some time without issue, the only thing I can identify that would be different on the site that's exhibiting the issue is that it is using a sub-theme of a sub-theme of Omega. In other words, there's the Omega base theme, then a theme we've built, and then a sub-theme based on our theme that the client is using.