In hosting_platform.module we have:


$servers = hosting_get_servers('http');
  if (sizeof($servers) > 1) {
    $form['web_server'] = array(
      '#type' => 'radios',
      '#title' => t('Web server'),
      '#description' => t('The web server the sites will be hosted on.'),
      '#options' => $servers,
      '#default_value' => ($node->web_server) ? $node->web_server : HOSTING_DEFAULT_WEB_SERVER,
    );
  }
  else {
    $form['web_server'] = array('#type' => 'hidden', '#value' => key($servers));
  }

I added a hook for the hosting_get_servers function the other day in #1189398: Add friendly name for Servers, and if you implement it and add a foreach over the array of servers, this then breaks the key($servers), as that will return <NULL.

Either, we change everywhere we use the results of hosting_get_servers to not be silly, or we always reset the array pointer in hosting_get_servers.

I prefer the former. Thoughts?

Comments

Steven Jones’s picture

Status: Active » Fixed

Actually it was only used like this in the one place, awesome!

Fixed in both branches.

Status: Fixed » Closed (fixed)

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

  • Commit cd2d777 on 6.x-2.x, 7.x-3.x, dev-ssl-ip-allocation-refactor, dev-sni, dev-helmo-3.x by Steven Jones:
    Issue #1191934 by Steven Jones: Fixed hook_hosting_servers_titles_alter...

  • Commit cd2d777 on 6.x-2.x, 7.x-3.x, dev-ssl-ip-allocation-refactor, dev-sni, dev-helmo-3.x by Steven Jones:
    Issue #1191934 by Steven Jones: Fixed hook_hosting_servers_titles_alter...