Fatal error: Call to a member function execute() on a non-object in C:\wamp\www\up\sites\all\modules\mobile_tools\mobile_tools.module on line 247

Comments

jbehshad’s picture

Same issue. I get a white screen after I enable the module.

twom’s picture

Assigned: Unassigned » twom
Status: Active » Needs review

Hi Guys,

Thx for the feeback. There was some part of the context integration that was not ported from D6 to D7!

I added the extra code, so it is ready to test.

Do not forget to disable/enable the module.

jbehshad’s picture

Well I got it working, played with the module for a few hours and had to disable it because we thought it was conflicting with another module(which it wasn't).
When I enabled mobile tools again it gave me a white screen. I disabled with drush, deleted the module and reinstalled the module but still the white screen.
Any suggestions?

jbehshad’s picture

From the error_log if it helps.

PHP Fatal error:  Call to a member function execute() on a non-object in /data/www.sitename.com/html/sites/all/modules/mobile_tools/mobile_tools.module on line 247, referer: http://www.sitename.com/admin/modules?render=overlay

PHP Fatal error:  Call to a member function execute() on a non-object in /data/www.sitename.com/html/sites/all/modules/mobile_tools/mobile_tools.module on line 247, referer: http://www.sitename.com/user/1

I guess its the same as the first post. Hmmm. I will delete the module again, download a fresh copy and see what happens from there.

mgifford’s picture

Same issue here.

twom’s picture

I added extra check if the mobile tools context plugin is correctly registered... So the WSOD should be gone...

I am still a bit puzzled why disabling / enabling causes the plugin to not be registered correctly (cache clear fixes it).

jbehshad’s picture

I cleared cache, ran cron, a little update.php, you know, the whole song and dance and nothing. Still when I enable the module(from fresh install) I get the WSOD.

[Thu May 26 15:46:20 2011] [error] [client xxx.xxx.xxx.xxx] PHP Warning:  Invalid argument supplied for foreach() in /data/www.xxxxx.xxxxxxxx.org/html/includes/module.inc on line 982, referer: http://xxxxx.xxxxxxxx.org/admin/appearance
[Fri Jun 03 17:33:00 2011] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  Call to a member function execute() on a non-object in /data/www.xxxxx.xxxxxxxx.org/html/sites/all/modules/mobile/mobile_tools/mobile_tools.module on line 247, referer: http://xxxxx.xxxxxxxx.org/admin/modules?render=overlay
[Fri Jun 03 17:33:01 2011] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  Call to a member function execute() on a non-object in /data/www.xxxxx.xxxxxxxx.org/html/sites/all/modules/mobile/mobile_tools/mobile_tools.module on line 247, referer: http://xxxxx.xxxxxxxx.org/
[Fri Jun 03 17:33:01 2011] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  Call to a member function execute() on a non-object in /data/www.xxxxx.xxxxxxxx.org/html/sites/all/modules/mobile/mobile_tools/mobile_tools.module on line 247
[Fri Jun 03 17:33:01 2011] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  Call to a member function execute() on a non-object in /data/www.xxxxx.xxxxxxxx.org/html/sites/all/modules/mobile/mobile_tools/mobile_tools.module on line 247
[Fri Jun 03 17:33:08 2011] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  Call to a member function execute() on a non-object in /data/www.xxxxx.xxxxxxxx.org/html/sites/all/modules/mobile/mobile_tools/mobile_tools.module on line 247, referer: http://xxxxx.xxxxxxxx.org/

I wish I could be of more assistance other than telling you whats wrong. I know little about PHP so thats about all I can do for you. Thank you for your work, it is appreciated.

carwin’s picture

subscribe. same issue, at least I think.

Enabling the module gives me WS with 500 error. So I disable with drush, clear cache re-enable etc... still WS. After disabling with drush I check the logs and see the following:

  • file 06/17/2011 - 16:37 The file was not deleted, because it does not exist. Anonymous (not verified)
  • system 06/17/2011 - 16:37 mobile_tools module disabled. Anonymous (not verified)
  • file 06/17/2011 - 16:37 The file was not deleted, because it does not exist. Anonymous (not verified)
  • system 06/17/2011 - 16:37 mobile_tools module enabled. Anonymous (not verified)

The file this is referring to is "http://default/index.php"

dstacey’s picture

I think same same: I reproduced WSOD issue with a clean (standard) install of D7.2
drush en context (no problems)
drush en mobile_tools = WSOD on one server, another server gave me:
Fatal error: Call to a member function execute() on a non-object in /var/www/....com/sites/....com/modules/mobile_tools/mobile_tools.module on line 247
line 247 =
if(module_exists('context')){
$plugin = context_get_plugin('condition', 'mobile');
if(!$plugin){
$device = mobile_tools_get_device();
$plugin->execute($device['type']);
$plugin->execute($device['group']);
}
}
}
If I "drush dis context" mobile tools works... as long as I don't enable Context.
Issue; can't enable Context and Mobile_tools at the same time.
log:
file 2011-06-22 17:00 The file was not deleted, because it does not exist.
system 2011-06-22 17:00 mobile_tools module disabled.
system 2011-06-22 16:38 mobile_tools module enabled.

jbehshad’s picture

Well that seems to be the issue. I disabled context and it works. Yahoo!!!
We can live with the block system for now.

hpk’s picture

But I need both mobile_tools and context module!

barami’s picture

Assigned: twom » Unassigned
Status: Needs review » Patch (to be ported)

change the following code (line 245, the part of mobile_tools_init() - mobile_tools.module)

/**
   * We set the context
   */
   if(module_exists('context')){
      $plugin = context_get_plugin('condition', 'mobile');
      if(!$plugin){
        $device = mobile_tools_get_device();
        $plugin->execute($device['type']);
        $plugin->execute($device['group']);
      }
   }

to

/**
   * We set the context
   */
   if(module_exists('context')){
      $plugin = context_get_plugin('condition', 'mobile');
      if($plugin){
        $device = mobile_tools_get_device();
        $plugin->execute($device['type']);
        $plugin->execute($device['group']);
      }
   }

another module's code using context_get_plugin function are runing execute function when true.
But mobile_tools execute when return is false.

After fixed this code, i can see mobile theme by my phone.

steven jones’s picture

Status: Patch (to be ported) » Active

There's no patch to port on this issue.

steven jones’s picture

Priority: Major » Critical
Status: Active » Needs review
StatusFileSize
new466 bytes
new474 bytes

Here's a patch that fixes the issue for me.

(And a patch for people who need to use drush make)

cpliakas’s picture

Patch in #14 worked for me.

dstacey’s picture

Thanks barami & Steven. Patch worked for me as well, nice work!

cpliakas’s picture

Status: Needs review » Reviewed & tested by the community
jessebeach’s picture

I just independently patched this in the same way before finding this issue. Let's get it in!

janes_p’s picture

I installed Mobile Tools on D 7.4 (Context active). After previous problems which ended in white screen, I just activated Mobile Tools Roles. Message:

Notice: Undefined variable: item in mobile_tools_roles_boot() (line 29 of /home/sites/abdagon.com/public_html/c22/sites/all/modules/mobile_tools/mobile_tools_roles.module).
Notice: Trying to get property of non-object in mobile_tools_roles_boot() (line 29 of /home/sites/abdagon.com/public_html/c22/sites/all/modules/mobile_tools/mobile_tools_roles.module).

steven jones’s picture

@janes_p: that's actually a slightly different issue to the one being sorted out here, could you open a new issue with that error please?

dandaman’s picture

Patch #14 worked for me! Please commit this to 7.x-2.x-dev, thanks.

lelizondo’s picture

Patch in #14 also worked for me

carwin’s picture

#14 seems good, is it committed?

lelizondo’s picture

no, is not committed yet.

minoroffense’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Committed