Skip to content

Scope bundled cron-expression and imagine under the Joomlatools\ namespace#765

Merged
amazeika merged 1 commit into
masterfrom
fix/764-scope-vendored-libraries
Jun 3, 2026
Merged

Scope bundled cron-expression and imagine under the Joomlatools\ namespace#765
amazeika merged 1 commit into
masterfrom
fix/764-scope-vendored-libraries

Conversation

@amazeika
Copy link
Copy Markdown
Member

@amazeika amazeika commented Jun 3, 2026

Problem

The framework bundles mtdowling/cron-expression and imagine/imagine in their original global namespaces (Cron\, Imagine\), and registers its Composer autoloader with prepend. On Joomla 6 — which ships its own Cron\CronExpression (dragonmantank) — our copy wins the class-resolution race, so com_scheduler's one-argument new Cron\CronExpression(...) fatals against our two-argument constructor. Every cron-expression scheduled task on any Joomla 6 site running a Joomlatools extension dies.

Fix

Relocate the bundled third-party libraries under a private Joomlatools\ prefix with Strauss, so they can never collide with the host CMS:

  • composer scope-vendor regenerates a single, self-contained vendor/ with an authoritative classmap, scoped under Joomlatools\
  • Dependencies are declared once in composer.json require; Strauss scopes them all (no per-package list)
  • The shipped libraries' PHP 8 patches (imagine GdImage, nullable types) are preserved as diffs applied via composer-patches on install/update
  • Scoping runs automatically on composer install/update, and mason build verifies scoping before packing (covering mason build and every extension mason bundle)
  • The framework's own Cron/Imagine callers are updated to the scoped prefix

Coordinated release

Breaking namespace change — must ship together with:

Closes #764

… namespace

Joomla 6 ships its own Cron\CronExpression (dragonmantank) in the global
namespace. Our bundled mtdowling/cron-expression registered the same
Cron\CronExpression through a prepended Composer autoloader and won the
resolution race, so the host scheduler instantiated our class with a single
argument and fataled with "Too few arguments". Any Joomla 6 site running a
Joomlatools extension with a cron-expression scheduler task hit this.

Relocate the bundled third-party libraries (cron-expression, imagine) under a
private Joomlatools\ prefix with Strauss, so they can never collide with the
host CMS's own copies:

- `composer scope-vendor` regenerates a single, self-contained vendor/ with an
  authoritative classmap, scoped under Joomlatools\ (Joomlatools\Cron,
  Joomlatools\Imagine)
- Dependencies are declared once in composer.json "require"; Strauss scopes all
  of them (no per-package list to maintain)
- The shipped libraries' PHP 8 patches (imagine GdImage handling, nullable
  parameter types) are preserved as diffs applied via composer-patches on
  install/update
- Scoping runs automatically on composer install/update via post-install/
  post-update hooks
- `mason build` verifies scoping (every classmap entry is scoped + every
  required package is present) before packing, covering `mason build` and every
  extension `mason bundle` (which delegates to it)
- Update the framework's own Cron and Imagine callers to the scoped prefix
@amazeika amazeika merged commit 9c30a39 into master Jun 3, 2026
1 check passed
@amazeika amazeika deleted the fix/764-scope-vendored-libraries branch June 3, 2026 14:17
@amazeika amazeika added this to the v6.1.0 milestone Jun 3, 2026
@amazeika amazeika mentioned this pull request Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundled cron-expression/imagine collide with host CMS namespaces (Joomla 6 scheduler TypeError)

1 participant