I'm getting a bunch of PHP errors every time the cron runs. I can't seem to track down what is causing them all, but one of the is this:
Warning: Cannot use a scalar value as an array in adaptivetheme_page_alter() (line 235 of /var/www/vhosts/tlthost.net/httpdocs/sites/all/themes/at_core/inc/alter.inc).
I'm hoping maybe if you folks know what's causing this one, it might help me figure out the rest of the errors.

CommentFileSizeAuthor
#10 cant_use_scalar_value.png4.01 KBkalidasan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jeff Burnz’s picture

Can you post all the errors, or a bunch of them - that one is coming from adaptivetheme_page_alter(), it calls at_get_browser() which is a wrapper for browscap_get_browser and should return true/false not an array so no need to initialize $page['is_mobile'] as an array. Weird.

wxman’s picture

Here's what I get:

Cannot use a scalar value as an array in drupal_render() (line 5822 of /var/www/vhosts/tlthost.net/httpdocs/includes/common.inc).
Cannot use a scalar value as an array in drupal_render() (line 5767 of /var/www/vhosts/tlthost.net/httpdocs/includes/common.inc).
Invalid argument supplied for foreach() in element_children() (line 6300 of /var/www/vhosts/tlthost.net/httpdocs/includes/common.inc).
Cannot use a scalar value as an array in adaptivetheme_page_alter() (line 235 of /var/www/vhosts/tlthost.net/httpdocs/sites/all/themes/at_core/inc/alter.inc).
Cannot use a scalar value as an array in user_relationships_ui_page_alter() (line 247 of /var/www/vhosts/tlthost.net/httpdocs/sites/tlt/modules/user_relationships/user_relationships_ui/user_relationships_ui.module).
Cannot use a scalar value as an array in fbconnect_page_alter() (line 568 of /var/www/vhosts/tlthost.net/httpdocs/sites/all/modules/fbconnect/fbconnect.module).
Cannot use a scalar value as an array in block_page_build() (line 269 of /var/www/vhosts/tlthost.net/httpdocs/modules/block/block.module).

The last one, array in block_page_build() line 269, comes up 4 or 5 times.
I thought I tracked it down to something in my template.php, but that didn't pan out.

Jeff Burnz’s picture

Title: PHP error on cron run » Cannot use a scalar value as an array

I can't really see this as a theme issue, if you look most of the notices are coming from things within Drupal core, I would try clearing your cache and possibly saving some module and theme settings again, you can see facebook connect has a problem also - but these are not typical issues or bugs I would think, just an odd problem with your installation.

deanflory’s picture

I'm getting these as well in my log but not as a warning/error on a page:

Warning: Cannot use a scalar value as an array in block_page_build() (line 269 of /home/account/public_html/drupal/modules/block/block.module).

I am using a custom/starter subtheme of AdaptiveTheme but it looks like it may be something else, dunno, just posting here as I just noticed these showing up in my log and haven't been able to find anywhere else they're mentioned.

If it's of any help, I'm currently trying to track down why I'm also having issues with batch operations (all but module update checking) not showing up and performing, therefore failing but without any error message, just no progress bar or progress but the page does completely load.

wxman’s picture

I took Jeff's advice and re-saved a bunch of the modules, but that didn't help. It really is a mystery.

inst’s picture

Hi,
I am working with AT too.
And got the same errors - without tellinig now, that is because I use AT.
Anyway, I will do some test and try to find out what is going oin behind that PHP messages.

best,
fr

Jeff Burnz’s picture

Can you guys tell me which version of Browscap you are using, if any?

Jeff Burnz’s picture

I might suggest that in get.inc in the core theme (look in adaptivetheme/at_core/inc/get.inc) right down the bottom of that file look for the function:

at_get_broswer()

and replace the line:

if ($browser['ismobiledevice'] == 1)

with...

if ($browser['ismobiledevice'] == TRUE)

wxman’s picture

I'm using browscap 7.x-1.3

kalidasan’s picture

FileSize
4.01 KB

Hi I have created one menu call back in my custom module.

 $items['sample_url'] = array(
 'title' => 'This is title',
 'page callback' => 'function_call',
 'access arguments' => array('access content'),
);

funtion function_call() {
  // my logic
  return TRUE;  // removed this line - Its fixed my issue.
}

When i removed "return TRUE;" from my function, this error went away.

So if you are running any function in your cron, please check its return value. If its not necessary remove it.
It may fix your issue.

Please find my attachment for error details.

Error details :
Warning: Cannot use a scalar value as an array in admin_menu_page_build() (line 166 of /app/mysite/public_html/sites/all/modules/contrib/admin_menu/admin_menu.module).

deanflory’s picture

Issue summary: View changes

I take it this is fixed in the current version of AdaptiveTheme as I'm unable to find if ($browser['ismobiledevice'] == 1)

but do see a section like this:

    else if (function_exists('browscap_get_browser')) {
      $browscap = browscap_get_browser();
      if (isset($browscap['ismobiledevice'])) {
        if (filter_var($browscap['ismobiledevice'], FILTER_VALIDATE_BOOLEAN) == TRUE) {
          $browser['is_mobile'] = TRUE;
        }
      }
    }

EDIT: scalar error source found and vanquished.

deanflory’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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