Skip to content

Commit b97c1b8

Browse files
fixed infinite loop and unwanted newline
1 parent 90c89e9 commit b97c1b8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

import.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
// This mess could need some cleanup!
99
if (isset($_POST['commands'])) {
10-
$commands = str_getcsv(str_replace("\n", ' ', $_POST['commands']).' ', ' ');
10+
// Append some spaces at the end to make sure we always have enough arguments for the last function.
11+
$commands = str_getcsv(str_replace(array("\r", "\n"), array('', ' '), $_POST['commands']).' ', ' ');
1112

1213
foreach ($commands as &$command) {
1314
$command = stripslashes($command);
@@ -24,7 +25,7 @@
2425
switch ($commands[$i]) {
2526
case 'SET': {
2627
$redis->set($commands[$i+1], $commands[$i+2]);
27-
$i =+ 2;
28+
$i += 2;
2829
break;
2930
}
3031

0 commit comments

Comments
 (0)