summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-07-31 14:17:31 +0000
committerErmal Luçi <eri@pfsense.org>2009-07-31 14:17:31 +0000
commit8e51cc6a53d96f247c7195be030f529a4d1cea7d (patch)
treed3bb17e172d07df8b89d8caf385d8e713b5c6d1a /etc
parent2b0eeeaad5fa55a994b2f2a49e165a453c78be88 (diff)
downloadpfsense-8e51cc6a53d96f247c7195be030f529a4d1cea7d.zip
pfsense-8e51cc6a53d96f247c7195be030f529a4d1cea7d.tar.gz
Circumvent weirdness of php when unsetting an array members during a loop.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/captiveportal.inc8
1 files changed, 6 insertions, 2 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index 0a06d63..d529ade 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -464,6 +464,7 @@ function captiveportal_prune_old() {
* the loop would evalate count() on every iteration and since $i would increase and count() would decrement they
* would meet before we had a chance to iterate over all accounts.
*/
+ $unsetindexes = array();
$no_users = count($cpdb);
for ($i = 0; $i < $no_users; $i++) {
@@ -525,7 +526,7 @@ function captiveportal_prune_old() {
if ($timedout) {
captiveportal_disconnect($cpdb[$i], $radiusservers,$term_cause,$stop_time);
captiveportal_logportalauth($cpdb[$i][4], $cpdb[$i][3], $cpdb[$i][2], "TIMEOUT");
- unset($cpdb[$i]);
+ $unsetindexes[$i] = $i;
}
/* do periodic RADIUS reauthentication? */
@@ -580,10 +581,13 @@ function captiveportal_prune_old() {
if ($auth_list['auth_val'] == 3) {
captiveportal_disconnect($cpdb[$i], $radiusservers, 17);
captiveportal_logportalauth($cpdb[$i][4], $cpdb[$i][3], $cpdb[$i][2], "RADIUS_DISCONNECT", $auth_list['reply_message']);
- unset($cpdb[$i]);
+ $unsetindexes[$i] = $i;
}
}
}
+ /* This is a kludge to overcome some php weirdness */
+ foreach($unsetindexes as $unsetindex)
+ unset($cpdb[$unsetindex]);
/* write database */
captiveportal_write_db($cpdb);
OpenPOWER on IntegriCloud