For some reason themekey is invoking to get node properties on bootstrapped pages. They are not nodes, and it is looking for a revision id (vid) when there is none to find.

Priority set to major because it causes functionality on sites with bootstrapped pages to completely break (aka white screen).

Error details from php, site url removed.
PHP Fatal error: Call to undefined function themekey_node_get_simple_node_property() in /var/www/vhosts/xxxxxxx/sites/all/modules/themekey/themekey_ui.module on line 94

This could all be wrong if I am actually doing something wrong with the setup, just let me know if you need further details and we can get this worked out if that is the case.
Thanks -Ariel

CommentFileSizeAuthor
#2 switching chain.png59.12 KBcoolestdude1
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mkalkbrenner’s picture

I need some more details.

What do you mean exactly with "bootstrapped pages"? Examples?

if function themekey_node_get_simple_node_property() is undefined, that means that the node.module is not installed ... strange.

At line 94 ThemeKey UI does not access a node it simulates a node.

But the function themekey_ui_nid2theme() - where the error happens - will be invoked only if ThemeKey already detected a node id.

What's the URL of the "bootstrapped page"?

Can you attach a screenshot of your ThemeKey rule chain?

coolestdude1’s picture

FileSize
59.12 KB

A bootstrapped page is a page that renders html outside of drupal, it usually starts with something similar to this

define('DRUPAL_ROOT', $_SERVER['DOCUMENT_ROOT']);
include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

The page is called by just going to the file as if the webserver just serves the php file bypassing the drupal render engine. There are many reasons why this needs to happen but I won't go into them.

The page that I am using to test is located https://xxxxx/sites/all/modules/xxxx/xxxxx/notes.tpl.php?sid=71
(site name, module name, module directory stucture hidden for security reasons)

The first lines of that file is posted above then some logic happens and then a simple print $content;
This worked perfectly before 7.x-2.2 and 7.x-2.1 but now themekey wont allow it.

I have attached an image of the switching chains with theme names taken out and a simple link hidden but both are unrelated.

mkalkbrenner’s picture

Status: Active » Postponed (maintainer needs more info)

Does it still work if you roll back to 2.0?
If it does, we can figure out, which patch since 2.0 breaks your setup.

But from my point of view, your usage is not standard drupal. I definitively need a full source code example of your setup to reproduce the issue.

coolestdude1’s picture

Status: Postponed (maintainer needs more info) » Active

It does not because the switching rule for 'themekey_ui:node_triggers_theme' still exists, switching it to disabled works however.

And it actually is common drupal for an external script to reference drupal without the render engine, see Drupal Bootstrap Process

All that really needs to happen is that when themekey gets to the 'themekey_ui:node_triggers_theme' to ignore all entities that are not nodes IE: menu links in the menu router, static pages.

Source code could be as simple as

define('DRUPAL_ROOT', $_SERVER['DOCUMENT_ROOT']);
include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
print "hello world";

Place that in a file and call it using the file path and it wont work if 'themekey_ui:node_triggers_theme' is enabled in you chain.

TimeBandit’s picture

FYI, same error for me with ThemeKey 6.x-4.0 upon upgrading Drupal from 6.27 to 6.28. Nothing else was changed or upgraded, just Drupal. Immediately got "Fatal error: Call to undefined function themekey_node_get_simple_node_property()" white screen.

Fortunately, even though my admin area is custom, the theme was working so I was able to try disabling rule "themekey_ui:node_triggers_theme". Once disabled, site loaded OK except of course any nodes that had used this rule for theme selection weren't displaying correctly so I needed to add some new rules.

The strange thing to me is that my custom theme worked in the Admin area but not outside of it. The Home is the only page that actually uses that rule, yet none of the web site was working except Admin area (same theme). i would have thought the error should only appear on the Home, and if it did appear on other pages (and it did) it seems it should have happened in the Admin area as well but did not.

mkalkbrenner’s picture

mkalkbrenner’s picture

strange, the function call should be save:

        if (function_exists($map_func)) {
          $parameters[$property] = $map_func($parameters[$map['src']], $arguments);
        }

Can some affected provide a debug backtrace?

mkalkbrenner’s picture

Status: Active » Fixed

@coolestdude1: for some reason there must be node when you bootstrap. Maybe because your front or error page is a node.

I added a check to avoid the fatal error, but I don't know what's going on on your site.
http://drupalcode.org/project/themekey.git/commit/6ec14ca

coolestdude1’s picture

Priority: Major » Normal

I am no longer in control of the site that I was having this issue with so I am not able to provide a proper backtrace. But I figured since the error was suppressed and there are ways to create rules around this issue it is necessary for me to drop the priority. I will leave the status as is unless someone else can help with the furthering of this issue. IE: Has a site that uses the bootstrap process in order to fulfill functionality.

Mainly it is great for Iframes and is really robust for accomplishing various functionality on a site. The most common use case I was seeing on my sites was for custom API's which only need to send headers and maybe a payload.

However I have a feeling that this issue may resurface, but thanks for the feedback.

Status: Fixed » Closed (fixed)

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