Version bump scripts perpetuate duplicate <version> tags in Joomla manifests #321

Closed
opened 2026-06-27 00:43:16 +00:00 by jmiller · 1 comment
Owner

Problem

version_bump.php, version_set_platform.php, and version_check.php all use unlimited preg_replace when updating <version> tags in Joomla XML manifests. If a duplicate <version> line ever gets introduced (merge conflict resolution, manual edit, etc.), every subsequent CI bump faithfully updates both copies — perpetuating the duplicate forever.

Observed in MokoSuiteBackup

After a rebase conflict resolution, mokosuitebackup.xml ended up with:

<version>01.43.23</version>
<version>01.43.23</version>

Every CI bump after that updated both lines, so the duplicate persisted across 01.43.24, 01.43.25, etc.

Additionally, pkg_mokosuitebackup.xml had a stray t character before the <version> tag (from a broken sed during conflict resolution). The version scripts don't touch leading whitespace, so the t persisted across all subsequent CI bumps.

Fix

  • Use limit=1 in preg_replace for the primary version replacement
  • Add a second pass to collapse any remaining duplicate <version> lines
  • Applied to all three scripts: version_bump.php, version_set_platform.php, version_check.php

Files affected

  • cli/version_bump.php
  • cli/version_set_platform.php
  • cli/version_check.php
## Problem `version_bump.php`, `version_set_platform.php`, and `version_check.php` all use unlimited `preg_replace` when updating `<version>` tags in Joomla XML manifests. If a duplicate `<version>` line ever gets introduced (merge conflict resolution, manual edit, etc.), every subsequent CI bump faithfully updates **both** copies — perpetuating the duplicate forever. ### Observed in MokoSuiteBackup After a rebase conflict resolution, `mokosuitebackup.xml` ended up with: ```xml <version>01.43.23</version> <version>01.43.23</version> ``` Every CI bump after that updated both lines, so the duplicate persisted across 01.43.24, 01.43.25, etc. Additionally, `pkg_mokosuitebackup.xml` had a stray `t` character before the `<version>` tag (from a broken sed during conflict resolution). The version scripts don't touch leading whitespace, so the `t` persisted across all subsequent CI bumps. ## Fix - Use `limit=1` in `preg_replace` for the primary version replacement - Add a second pass to collapse any remaining duplicate `<version>` lines - Applied to all three scripts: `version_bump.php`, `version_set_platform.php`, `version_check.php` ## Files affected - `cli/version_bump.php` - `cli/version_set_platform.php` - `cli/version_check.php`
Author
Owner

Branch created: feature/321-version-bump-scripts-perpetuate-duplicat

git fetch origin
git checkout feature/321-version-bump-scripts-perpetuate-duplicat
Branch created: [`feature/321-version-bump-scripts-perpetuate-duplicat`](https://git.mokoconsulting.tech/MokoConsulting/MokoCLI/src/branch/feature/321-version-bump-scripts-perpetuate-duplicat) ```bash git fetch origin git checkout feature/321-version-bump-scripts-perpetuate-duplicat ```
Sign in to join this conversation.
No labels
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoCLI#321