Skip to content

Commit 12b0f34

Browse files
committed
Fix $i could be affected by the socket settings not being of the same length
"Looping through $sockets using the same index variable $i interferes with $i--; on the following line. PMA_HOSTS & PMA_SOCKETS may not be of equal length."
1 parent f79c707 commit 12b0f34

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

config.inc.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@
135135
$cfg['Servers'][$i]['compress'] = false;
136136
$cfg['Servers'][$i]['AllowNoPassword'] = true;
137137
}
138-
for ($i = 1; isset($sockets[$i - 1]); $i++) {
139-
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
140-
$cfg['Servers'][$i]['host'] = 'localhost';
138+
// Avoid overwriting the last server id $i, use another variable name
139+
for ($socketHostId = 1; isset($sockets[$socketHostId - 1]); $socketHostId++) {
140+
$cfg['Servers'][$socketHostId]['socket'] = $sockets[$socketHostId - 1];
141+
$cfg['Servers'][$socketHostId]['host'] = 'localhost';
141142
}
142143
/*
143144
* Revert back to last configured server to make

0 commit comments

Comments
 (0)