Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
Steven Jones CreditAttribution: Steven Jones commentedActually it was only used like this in the one place, awesome!
Fixed in both branches.