I have just installed Mobile Tools 7.x-2.x-dev on a fresh install of Drupal 7.2 and am getting the following error message:

Undefined variable: item in mobile_tools_roles_boot()

Is this a known issue?

Many thanks.

CommentFileSizeAuthor
#13 undefined-variable-item-1179210-13.patch701 bytesramlev

Comments

jbehshad’s picture

I get the same issue.

Notice: Undefined variable: item in mobile_tools_roles_boot() (line 29 of /html/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 /html/sites/all/modules/mobile_tools/mobile_tools_roles.module).
Notice: Undefined variable: item in mobile_tools_roles_boot() (line 29 of /html/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 /html/sites/all/modules/mobile_tools/mobile_tools_roles.module).
davecoventry’s picture

It would appear that the error occurs when the "Mobile Tools Roles" module is enabled.

joekrukosky’s picture

Subscribing

Andy B’s picture

sub

This happens even if roles are not enabled. As soon as I enabled mobile_tools and then reloaded the site, I started getting errors like this.

wandabee’s picture

Very new to Drupal, so I'm working off a fresh install as well... Receiving the same errors. I'll definitely keep my eye on this post!

jackbates’s picture

Category: support » bug

Add my 2p:

Notice: Undefined variable: item in mobile_tools_roles_boot() (line 29 of /.../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 /.../sites/all/modules/mobile_tools/mobile_tools_roles.module).

I'm not a coder, I'm a PM/Process Guy. I hope a coder out there can fix this, because this module shows great promise and I'd love to use it in projects moving forward!

hoysala’s picture

Component: User interface » Code

I guess, developer missed to retrieve result from object, Fix should be something like below at line 29

  //count the number of mobile roles... must be bigger then 1
  $result = db_query("SELECT COUNT(*) as count FROM {mobile_tools_roles_relations}");

  $items = $result->fetchObject();

  if ($items->count > 1 ) {
erlingpj’s picture

I added the "$items = $result->fetchObject();", still same error.

bencbusch’s picture

Here's what I did to get the error to go away... By no means the best solution, but at least my site no longer displays the error on all pages:

1. Disable all mobile tools and browscap modules possible under modules menu (for me was just the mobile tools roles and browscap (mobile tools contrib) that I could uncheck

2. Click on uninstall tab - uninstall mobile tools roles should appear

3. Uninstall mobile tools roles

That fixed it for me and I can invoke theme switching just fine... Btw, the module mobil tools roles still shows up in the modules list, but I have avoided checking it this time.

Again, not the 'right' fix, but got my site working again without errors... Hope this helps.

jhood’s picture

I can confirm that following the three steps made the errors disappear on my site. Thanks!

sstrigger’s picture

I think it's actually supposed to be

  $result = db_query("SELECT COUNT(*) as count FROM {mobile_tools_roles_relations}");
  $item = $result->fetchObject();
  if ($item->count > 0) {
gbowman’s picture

I made the change suggested in post #11 which removed the error, however I can't actually see if the module is working.

I'm expecting to see some sort of configuration in the mobile tools section to select a particular role to apply. What am I missing??

ramlev’s picture

StatusFileSize
new701 bytes

Created a valid patch from comment #11, easier for the maintainer to implement.

tomate2010’s picture

subscribe

minoroffense’s picture

Status: Active » Needs review
innstudio’s picture

Excellent, thank you for this solution.

mfarnsworth’s picture

Hi, thanks for the patch! Being a newbie I can't figure out how to apply it. Do I edit a particular fine in the installation and replace a bit of cone in the file with this code and, if so, which file? Is it only a section of code in the file, i.e. fro which line to which line, or is this some sort of command line thing I have to to?

Anything you can tell me, such as where to find out how to apply a patch, will be very wonderful. I've been looking and so far come up dry.

Thank you in advance.

ramlev’s picture

http://www.google.com/search?btnG=1&pws=0&q=drupal+apply+patch Should lead you in the correct direction.

minoroffense’s picture

Status: Needs review » Closed (fixed)

Patch committed to dev.

Thanks a lot!