Skip to content

Commit a0e0282

Browse files
committed
Fix $i could be affected by the socket settings not being of the same length
Sync all variants Ref: 12b0f34 "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 e1fe998 commit a0e0282

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

apache/config.inc.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,10 @@
205205
$cfg['Servers'][$i]['compress'] = false;
206206
$cfg['Servers'][$i]['AllowNoPassword'] = true;
207207
}
208-
for ($i = 1; isset($sockets[$i - 1]); $i++) {
209-
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
210-
$cfg['Servers'][$i]['host'] = 'localhost';
208+
// Avoid overwriting the last server id $i, use another variable name
209+
for ($socketHostId = 1; isset($sockets[$socketHostId - 1]); $socketHostId++) {
210+
$cfg['Servers'][$socketHostId]['socket'] = $sockets[$socketHostId - 1];
211+
$cfg['Servers'][$socketHostId]['host'] = 'localhost';
211212
}
212213
/*
213214
* Revert back to last configured server to make

fpm-alpine/config.inc.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,10 @@
205205
$cfg['Servers'][$i]['compress'] = false;
206206
$cfg['Servers'][$i]['AllowNoPassword'] = true;
207207
}
208-
for ($i = 1; isset($sockets[$i - 1]); $i++) {
209-
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
210-
$cfg['Servers'][$i]['host'] = 'localhost';
208+
// Avoid overwriting the last server id $i, use another variable name
209+
for ($socketHostId = 1; isset($sockets[$socketHostId - 1]); $socketHostId++) {
210+
$cfg['Servers'][$socketHostId]['socket'] = $sockets[$socketHostId - 1];
211+
$cfg['Servers'][$socketHostId]['host'] = 'localhost';
211212
}
212213
/*
213214
* Revert back to last configured server to make

fpm/config.inc.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,10 @@
205205
$cfg['Servers'][$i]['compress'] = false;
206206
$cfg['Servers'][$i]['AllowNoPassword'] = true;
207207
}
208-
for ($i = 1; isset($sockets[$i - 1]); $i++) {
209-
$cfg['Servers'][$i]['socket'] = $sockets[$i - 1];
210-
$cfg['Servers'][$i]['host'] = 'localhost';
208+
// Avoid overwriting the last server id $i, use another variable name
209+
for ($socketHostId = 1; isset($sockets[$socketHostId - 1]); $socketHostId++) {
210+
$cfg['Servers'][$socketHostId]['socket'] = $sockets[$socketHostId - 1];
211+
$cfg['Servers'][$socketHostId]['host'] = 'localhost';
211212
}
212213
/*
213214
* Revert back to last configured server to make

0 commit comments

Comments
 (0)