[TASK] Fix failing quality gates on main#727
Merged
Merged
Conversation
ComposerPackageManager::getPackageComposerJson() passed the JSON_THROW_ON_ERROR constant as the third argument of json_decode(), which is $depth, leaving $flags at its default value 0. The flag therefore never took effect: malformed composer.json content did not raise a JsonException, which turned the surrounding try/catch block into dead code, while $depth was set to the constant value 4194304. The call now uses the default depth of 512 and passes the flag in the $flags argument, so decoding errors are handled as originally intended. Observable behaviour does not change, since json_decode() returns null for invalid input, which already matched the intended null fallback of the method. PHPStan 2.2 reports the previous call as argument.invalidConstant. As composer.lock is not part of the repository, CI resolves the latest PHPStan release, which turned this into a failing quality gate on the PHP 8.2 and 8.3 jobs. Releases: main, 9, 8
TYPO3 v15 no longer evaluates "ext_emconf.php" and requires extensions to declare the extension version and the "providesPackages" definition in the "extra/typo3/cms" section of their composer.json, see deprecation #108345. Extensions missing that metadata make the core PackageManager throw an InvalidPackageManifestException. The fixture extensions of the PackageCollection sorting test did not declare that metadata, which let the unit test suite fail when core v15 is installed: InvalidPackageManifestException: The composer.json of extension "package2" must declare the extension version and the "providesPackages" definition in the "extra/typo3/cms" section. The fixture composer.json files now declare "version" and an empty "providesPackages" object. That metadata also marks an extension as "composer only capable" for core v14, which stops merging "ext_emconf.php" into the manifest there as well. Both supported core versions therefore resolve package constraints from composer.json only and provide the same loading order again. This changes the expected order: the "unsynced" fixtures declare a dependency in "ext_emconf.php" that is not present in their composer.json, and that dependency is no longer taken into account. "extension_unsynced_extemconf" and "extension2_unsynced_extemconf" swap positions, which is reflected in the test expectations and in the sorted package states fixture. The "IgnoreDeprecations" attribute is dropped, as the fixtures no longer trigger the "ext_emconf.php" deprecation on core v14. Releases: main
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.
Fixes both quality gates that currently fail on
main, independent of anypending pull request. Both failures reproduce on a plain
maincheckout.[BUGFIX] Pass JSON_THROW_ON_ERROR as flagsComposerPackageManager::getPackageComposerJson()passedJSON_THROW_ON_ERRORas the third argument of
json_decode(), which is$depth, leaving$flagsat0. The flag never took effect, the surroundingtry/catchwas dead code, and$depthwas set to4194304. Observable behaviour does not change, sincejson_decode()returnsnullfor invalid input, which already matched theintended
nullfallback.PHPStan 2.2 reports this as
argument.invalidConstant. Ascomposer.lockis notpart of the repository, CI resolves the latest PHPStan release, which turned a
long-standing defect into a failing gate on the PHP 8.2 and 8.3 jobs.
[TASK] Declare v15 package metadata in fixturesTYPO3 v15 no longer evaluates
ext_emconf.phpand requires extensions to declarethe extension version and the
providesPackagesdefinition in theextra/typo3/cmssection ofcomposer.json, see deprecation #108345. Extensionsmissing that metadata make the core
PackageManagerthrow anInvalidPackageManifestException:Only the PHP 8.5 job hits this, because
typo3/cms-coredev-mainrequiresphp: ^8.5; the 8.2, 8.3 and 8.4 jobs resolve to14.3.x-dev.The fixture
composer.jsonfiles now declareversionand an emptyprovidesPackagesobject. That metadata also marks an extension as "composeronly capable" for core v14 (
PackageManager::isComposerOnlyCapable()), whichstops merging
ext_emconf.phpinto the manifest there as well. Both supportedcore versions therefore resolve package constraints from
composer.jsononly andprovide the same loading order, so no core-version-aware expectations are needed.
The expected order changes accordingly: the "unsynced" fixtures declare a
dependency in
ext_emconf.phpthat is not present in theircomposer.json, andthat dependency is no longer taken into account.
extension_unsynced_extemconfand
extension2_unsynced_extemconfswap positions. TheIgnoreDeprecationsattribute is dropped, as the fixtures no longer trigger the
ext_emconf.phpdeprecation on core v14.
Test results
Full
ci.ymlmatrix executed locally,cglandphpstanonly for PHP <= 8.3 asin CI:
Follow-ups, not part of this pull request
PackageCollectionclass docblock still describesext_emconf.phpas theclassic mode source of truth with a
composer.jsonfallback, which is invertednow. The
@todoinPackageCollection::fromPackageStates()is effectivelyanswered by core v15.
Resources/Core/Functional/Extensions/{json_response,private_container}stillrequire
typo3/cms-core: 13.*.*@dev || 14.*.*@devwhilemaintargets v14 andv15. Both already declare the package metadata needed for v15.
will hard-fail on core v15 instead of degrading. Worth a release note for the
next
10.xtag.