Scope bundled cron-expression and imagine under the Joomlatools\ namespace#765
Merged
Conversation
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The framework bundles
mtdowling/cron-expressionandimagine/imaginein their original global namespaces (Cron\,Imagine\), and registers its Composer autoloader with prepend. On Joomla 6 — which ships its ownCron\CronExpression(dragonmantank) — our copy wins the class-resolution race, socom_scheduler's one-argumentnew 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-vendorregenerates a single, self-containedvendor/with an authoritative classmap, scoped underJoomlatools\composer.jsonrequire; Strauss scopes them all (no per-package list)GdImage, nullable types) are preserved as diffs applied viacomposer-patcheson install/updatecomposer install/update, andmason buildverifies scoping before packing (coveringmason buildand every extensionmason bundle)Coordinated release
Breaking namespace change — must ship together with:
Closes #764