Download & Extend

Context error on update from 6.x-2.2 to 6.x-2.3

Project:Mobile Tools
Version:6.x-2.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

Hi,

I upgraded 6.x-2.2 to 6.x-2.3 and contexts for mobile device in context condition stopped working. Then, I downgraded to 6.x-2.2 again and it started working again.

Am I missing something on upgrade process? Or, is this a bug? I can't provide any suggestions yet since I'm new to Mobile Tools and Context API.

Thanks :)

Comments

#1

Status:active» needs review

Not sure if this is the same issue, but when I initially installed mobile_tools -- before upgrading context -- I white screened because the earlier version of context did not use the function context_get_plugin(). The attached patch uses function_exists("context_get_plugin") rather than module_exists("context"), which will at least prevent a fatal PHP error.

To get context integration, you'll still need to upgrade to the latest stable context release.

AttachmentSize
context_fix-1185974-1.patch 588 bytes

#2

It's different issue. Well, it looks like I didn't clearly say what the problem was. :-P

I was using Context 6.x-3.0 and Mobile Tools 6.x-2.2 to detect client's device. My system detected devices correctly until I updated Mobile Tools to 6.x-2.3 version. There was no error message appeared. It just failed in device detection.

:)

#3

just hit this one as well. Any ideas what is causing this?

#4

Got it. Real simple fix so I didn't bother to create a patch

in mobile_tools.module
function mobile_tools_init
line 217

   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']);
      }
   }

Should be:

   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']);
      }
   }

Just a problem of using the wrong polarity in the if statement.

#5

#4 works for me, thanks !

#6

Status:needs review» closed (duplicate)

This has been fixed in #1118108-5: Call to a member function execute() on a non-object in /home/... /all/modules/mobile_tools/mobile_tools.module on line 221, but it's not very clear in the issue.