Skip to content

Fix the 2.x merge on 2-to-3 - #1674

Closed
Amoifr wants to merge 8 commits into
liip:2-to-3from
Amoifr:fix-2-to-3-ci
Closed

Amoifr wants to merge 8 commits into
liip:2-to-3from
Amoifr:fix-2-to-3-ci

Conversation

@Amoifr

@Amoifr Amoifr commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1653 (comment): fixes the drift of the 2.x merge on 2-to-3, one commit per kind of problem.

  • Files the merge did not carry over. Files added on 2.x after the move to src/ and tests/ were left out: the AssetMapper locator and loader factory (already referenced by the bundle class and the service config, which caused the 57 test errors), their tests and docs, doc/events.rst (still in the index), and the console used by lint:container. I compared every file of 2.x at the merge point with the 3.x tree: the other missing files were removed on purpose in 3.x (Enqueue, Templating, CacheResolver, legacy Twig mode...).
  • 3.x service changes lost in the PHP service config. The merge took the 2.x PHP files, so the three changes 3.x had made to imagine.xml were gone: the guessers based on symfony/mime, and the removal of the deprecated paste/watermark loaders and of the CacheResolver prototype.
  • mb_ltrim()/mb_rtrim(). The "cs fixer" commit, run with mb_str_functions on PHP 8.4+, replaced 21 ltrim()/rtrim() calls with functions that only exist since PHP 8.4. Recent symfony/polyfill-mbstring versions define them, but not the one installed with the lowest dependencies (1.17.0): the "PHP 8.1 + lowest" job failed with 87 "undefined function mb_rtrim()" errors, so I reverted them. The CS job runs on 8.3, where the fixer leaves ltrim() alone.
  • PHP 8.5 jobs. setAccessible() in AbstractTest triggers a self deprecation on PHP 8.5, which fails the build with max[self]=0. It has no effect since 8.1, so I removed it.
  • phpunit workflow. The merged one tested Symfony 7.0 (not allowed by composer.json anymore), kept a minimum-stability step whose matrix value was removed, and lost the asset-mapper step. I took the 2.x workflow, without the enqueue step, with the 3.x trigger and the console path in tests/.
  • Two small leftovers: $acl ?? '' on a non-nullable parameter, and a call to the 2.x-only expectExceptionMessageMatchesBC().
  • PHPStan. What remained after the fixes is 14 false positives of phpstan-symfony 1.x on the generic NodeBuilder/ExprBuilder of symfony/config 7.4. I ignored them with a comment rather than moving to PHPStan 2 here: PHPStan 2 + phpstan-symfony 2 do not report them, but report other level 6 findings unrelated to the merge. Happy to do that move in a separate PR if you want, or drop the last commit.

Checked locally: 948 tests green on PHP 8.5 (with symfony/asset-mapper installed, only the 6 imagick tests skipped), lint:container OK, PHPStan clean on PHP 8.2 like the CI job. Not checked locally: the PHPUnit jobs on PHP 8.1 to 8.4 (missing extensions here); the first CI run is what showed the two points above. The php-cs-fixer job failed because setup-php could not download the tool (empty release tag), unrelated to the changes.

The merge of 2.x only updated files that already existed in the 3.x
layout, so the files added on 2.x after the move to src/ and tests/
were left out or kept at their old place:

- AssetMapperLocator and AssetMapperLoaderFactory, with their tests
  and documentation (the bundle class and the service config already
  referenced them). The factory gets the typed 3.x signatures.
- doc/events.rst, still listed in the documentation index.
- the console used by the lint:container CI step, moved from
  Tests/Functional/app/bin to tests/Functional/app/bin.
2.x converted the service definitions from XML to PHP, and the merge
took the 2.x files, dropping what 3.x had changed in imagine.xml:

- the mime type and extension guessers use symfony/mime MimeTypes
  again instead of the HttpFoundation guessers removed in Symfony 5
- remove the deprecated paste and watermark filter loaders using
  %kernel.root_dir%
- remove the prototype of the CacheResolver removed in 3.x
The merged workflow tested Symfony 7.0, which composer.json no longer
allows, kept a minimum-stability step whose matrix value was removed,
and lost the step adding symfony/asset-mapper. Take the 2.x workflow,
without the enqueue step (Enqueue support is removed in 3.x), with the
3.x branch trigger and the console path in tests/.
- drop the "?? ''" on $acl, which is a non-nullable string in 3.x
- call expectExceptionMessageMatches(), the BC helper of 2.x does not
  exist in 3.x
phpstan-symfony 1.x reports every call on the generic NodeBuilder and
ExprBuilder types of symfony/config 7.4 as a call on an unknown class.
These errors are gone with phpstan 2 and phpstan-symfony 2.
The mb_str_functions fixer, run on PHP 8.4 or later, replaced these
calls with mb_ltrim() and mb_rtrim(), which only exist since PHP 8.4.
On older PHP versions they come from symfony/polyfill-mbstring, but
only from recent versions of it: with the lowest dependencies (1.17.0
in CI), every call is an "undefined function" error on PHP 8.1.
The characters trimmed are ASCII, so the byte functions give the same
result.
It has no effect since PHP 8.1, the minimum version of the bundle, and
the PHP 8.5 jobs fail on the self deprecation notice it triggers.
@dbu

dbu commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

thanks. i would like to fix the ltrim/rtrim to use the mb_ versions, instead of reverting that. can we raise the lowest version we allow, if we require the polyfill directly in the requirement, otherwise with a conflict for the too low version?

the cs fixer test seems to have a problem with shivammathur/setup-php downloading the php-cs-fixer. it has no version in the url: php-cs-fixer Failed to download php-cs-fixer from https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download//php-cs-fixer.phar - the // looks odd. would be cool if you can find what the problem there is.

…ring 1.31

Revert 10ff537: polyfill-mbstring defines mb_ltrim() and mb_rtrim()
since 1.31.0, so requiring it directly makes the lowest dependencies
resolve a version that has them, instead of 1.17.0.
@Amoifr

Amoifr commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Done: the mb_ltrim()/mb_rtrim() calls are back, and symfony/polyfill-mbstring is now required directly with ^1.31, the first release that defines them. With --prefer-lowest it now resolves 1.31.0 instead of 1.17.0.

About php-cs-fixer: the // in the URL is an empty version. The workflow asks setup-php for php-cs-fixer without a version, so setup-php first looks up the latest release through the GitHub API, and that lookup came back empty on this run. The same workflow passed on 2.x yesterday, so it looks transient (my guess is an API rate limit, I could not confirm it). This push reruns it anyway; if it happens again, pinning an exact version (e.g. php-cs-fixer:3.95.30) should skip the lookup.

@dbu

dbu commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

thanks a lot! i merged on the cli to squash the mb_ltrim/rtrim thing rather than have the removal and the revert.

@dbu dbu closed this Nov 15, 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.

2 participants