1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-25 15:51:37 +02:00
This commit is contained in:
Ryan Cramer
2019-02-05 08:39:21 -05:00
parent 69bd63eb4c
commit 1215e706e1

View File

@@ -319,7 +319,7 @@ abstract class WireSaveableItems extends Wire implements \IteratorAggregate {
$n = 0;
if(!strlen($name)) $name = $item->name;
// ensure the new name is unique
while($this->get($name)) $name = $item->name . '_' . (++$n);
while($this->get($name)) $name = rtrim($item->name, '_') . '_' . (++$n);
$item->name = $name;
}