Short description of the issue
Commit 72be1bfd added a sort-order change detector in RepeaterPageArray and FieldtypeRepeater that uses strpos("$value", $loadOrder) === 0 against the PageArray's __toString form (id1|id2|...). Because it's a substring prefix check rather than a token comparison, it false-matches on digit-prefix collisions between IDs.
Expected behavior
In-place ID substitutions or reorderings that change the effective sort sequence cause applySortOrder() to run.
Actual behavior
wire/modules/Fieldtype/FieldtypeRepeater/RepeaterPageArray.php:206 and FieldtypeRepeater.module:1590:
$loadOrder = $value->finderOptions('loadOrder');
if($loadOrder && strpos("$value", $loadOrder) !== 0) {
// ... applySortOrder ...
}
Failure cases:
loadOrder = "1", current "10" → strpos === 0 → applySortOrder skipped (ID 1 replaced with ID 10 in a single-item list).
loadOrder = "12|345", current "12|3456" → strpos === 0 → skipped (item 345 removed, item 3456 added in same slot).
Optional: Suggestion for a possible fix
Compare as tokens or use full-string equality:
$current = (string) $value;
if($loadOrder && $loadOrder !== $current) {
// ... applySortOrder ...
}
Setup/Environment
- ProcessWire version:
dev @ 15c749ed
- Files:
wire/modules/Fieldtype/FieldtypeRepeater/RepeaterPageArray.php:206 and FieldtypeRepeater.module:1590
- Introduced in commit 72be1bfd
Short description of the issue
Commit 72be1bfd added a sort-order change detector in
RepeaterPageArrayandFieldtypeRepeaterthat usesstrpos("$value", $loadOrder) === 0against the PageArray's__toStringform (id1|id2|...). Because it's a substring prefix check rather than a token comparison, it false-matches on digit-prefix collisions between IDs.Expected behavior
In-place ID substitutions or reorderings that change the effective sort sequence cause
applySortOrder()to run.Actual behavior
wire/modules/Fieldtype/FieldtypeRepeater/RepeaterPageArray.php:206andFieldtypeRepeater.module:1590:Failure cases:
loadOrder = "1", current"10"→strpos === 0→ applySortOrder skipped (ID 1 replaced with ID 10 in a single-item list).loadOrder = "12|345", current"12|3456"→strpos === 0→ skipped (item 345 removed, item 3456 added in same slot).Optional: Suggestion for a possible fix
Compare as tokens or use full-string equality:
Setup/Environment
dev@15c749edwire/modules/Fieldtype/FieldtypeRepeater/RepeaterPageArray.php:206andFieldtypeRepeater.module:1590