You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pluralize() throws on BoxLang for words ending in -ex, -lf or -rf #4185
On BoxLang, pluralize() throws for common words ending in -ex or in -lf / -rf:
pluralize("vertex") // Index -1 out of bounds for length 4
pluralize("index") // same
pluralize("half") // Index -1 out of bounds for length 5
pluralize("shelf") // same
pluralize("wolf") // same
Lucee and Adobe ColdFusion return vertices, indices, halves, shelves and wolves. Because model names and association names go through pluralize(), a model named Shelf or Index can fail on BoxLang.
Cause. Two pluralize rules in vendor/wheels/global/strings.cfm combine alternatives in a single regex, and only one alternative sets group 1:
(matr|vert|ind)ix|ex$ → \1ices. For vertex the ex$ alternative matches, so \1 is unset.
(?:([^f])fe|([lr])f)$ → \1\2ves. For half the ([lr])f alternative matches, so \1 is unset.
Lucee and Adobe replace an unset group with an empty string. BoxLang throws.
Fix. Split each rule into two, so every group a replacement refers to takes part in its match. Output on Lucee and Adobe is unchanged.
Activity