diff --git a/helper.php b/helper.php index dec5152..801a7f7 100644 --- a/helper.php +++ b/helper.php @@ -316,7 +316,7 @@ function rewrite_content($text, $id, $moves) { while($changed) { $changed = false; foreach($tmp_moves as $old => $new) { - if(isset($moves[$new]) && $moves[$new] != $new) { + if($old != $new && isset($moves[$new]) && $moves[$new] != $new) { $tmp_moves[$old] = $moves[$new]; $changed = true; } @@ -325,7 +325,8 @@ function rewrite_content($text, $id, $moves) { // manual merge, we can't use array_merge here as ids can be numeric foreach($tmp_moves as $old => $new) { - $moves[$old] = $new; + if ($old == $new) unset($moves[$old]); + else $moves[$old] = $new; } $handlers = array();