Notice: Undefined offset: 1 in drupal_http_request() (line 989 of /var/www/vhosts/be/includes/common.inc).
Notice: Undefined offset: 2 in drupal_http_request() (line 993 of /var/www/vhosts/be/includes/common.inc).
Notice: Undefined offset: 1 in drupal_http_request() (line 993 of /var/www/vhosts/be/includes/common.inc).
Warning: Invalid argument supplied for foreach() in _bootstrap_settings_form() (line 81 of /var/www/vhosts/be/sites/all/themes/bootstrap/theme/settings.inc)

I get these errors on the theme admin page. Sometimes the Bootswatch theme options are missing, if I save the page sometimes they return - however there seems to be no consistency on this.

Comments

jeremymcminn’s picture

Retried this bug am getting the following error including the above when trying to select a Bootswatch Theme and then all the options in the list disappear apart from "Disabled"

An illegal choice has been detected. Please contact the site administrator.

valkum’s picture

There seems to be some problems with drupal_http_request in your environment. Or the connection of your server to the bootswatch api server.

valkum’s picture

Should we add a check if the data is correct before we us the var in foreach?

like this?

 // Bootswatch.
  $bootswatch_themes = array();
  $request = drupal_http_request('http://api.bootswatch.com/3/');

if ($request is valid){

  $api = drupal_json_decode($request->data);
}
if ($api is valid) {

  foreach ($api['themes'] as $bootswatch_theme) {
    $bootswatch_themes[strtolower($bootswatch_theme['name'])] = $bootswatch_theme['name'];
  }
}
markhalliwell’s picture

Status: Active » Fixed

Thanks @jeremymcminn!

Hopefully this should fix the offset errors and provide a more useful error message. It sounds like your hosting server doesn't allow HTTP requests to be made, in this case, there is unfortunately not much we can do to get around that :(

Committed cf4361e to 7.x-3.x:

Issue #2108209 by Mark Carver | jeremymcminn: Fixed Undefined offset and invalid arguments errors in theme settings page.

valkum’s picture

Version: 7.x-3.x-dev » 7.x-3.0-rc2
jeremymcminn’s picture

That is unfortunate - I do have a VPS with MediaTemple so I'm sure I'll be able to find a way around it. Thanks.

jeremymcminn’s picture

Issue summary: View changes

Note about no consistency on error.

Status: Fixed » Closed (fixed)

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