Fix PPPoE upgrade, the <pppoe> tag is considered an array these days and the upgrade code wasn't treating it properly, accessing it directly instead of using the first entry ([0]). Fixes #1439 - PPPoE credentials upgrade properly now.

This commit is contained in:
jim-p 2011-04-21 13:10:32 -04:00
parent 46698c3f3c
commit 1f0c76cfd7

View File

@ -1262,13 +1262,13 @@ function upgrade_047_to_048() {
unset($config['dnsupdate']);
}
if (is_array($config['pppoe'])) {
if (is_array($config['pppoe']) && is_array($config['pppoe'][0])) {
$pconfig = array();
$pconfig['username'] = $config['pppoe']['username'];
$pconfig['password'] = $config['pppoe']['password'];
$pconfig['provider'] = $config['pppoe']['provider'];
$pconfig['ondemand'] = isset($config['pppoe']['ondemand']);
$pconfig['timeout'] = $config['pppoe']['timeout'];
$pconfig['username'] = $config['pppoe'][0]['username'];
$pconfig['password'] = $config['pppoe'][0]['password'];
$pconfig['provider'] = $config['pppoe'][0]['provider'];
$pconfig['ondemand'] = isset($config['pppoe'][0]['ondemand']);
$pconfig['timeout'] = $config['pppoe'][0]['timeout'];
unset($config['pppoe']);
$config['interfaces']['wan']['pppoe_username'] = $pconfig['username'];
$config['interfaces']['wan']['pppoe_password'] = $pconfig['password'];