Skip to content

2 to upgrade branch - #1678

Merged
dbu merged 38 commits into
2-to-3from
2-to-upgrade-branch
Nov 18, 2026
Merged

dbu merged 38 commits into
2-to-3from
2-to-upgrade-branch

Conversation

@dbu

@dbu dbu commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Trying to get the remaining changes from 2.x to the 2-to-3 branch, solving lots of conflicts.

@Amoifr would you have time for a second pair of eyes?

Atesca and others added 30 commits July 11, 2026 13:54
In lazy mode, absolute image URLs (S3/Flysystem/VichUploader) were passed
to the CacheManager unchanged, breaking cache resolution. Legacy mode
always ran parse_url($path, PHP_URL_PATH) first; LazyFilterRuntime dropped
it (commit 13a32e4).

Restore that normalization in cleanPath() (covers filter() and
filterCache()), but only when the path has a host, so local filenames
containing "?" or "#" are left untouched.

Fixes #1447
parse_url(PHP_URL_PATH) returns a truncated string for local paths
containing "?" or "#", so the ?? $path fallback does not catch them;
the host check is what limits the rewrite to absolute URLs. Add a
comment and an explicitly named regression test so removing the guard
fails with an obvious message.
Fix lazy Twig mode dropping the path for absolute image URLs
drop support for PHP 8.0, the build was not installable anymore anyways
When `liip_imagine.webp.generate` is enabled, every cached image also has
a "<path>.webp" companion (FilterService::buildFilterPathContainers).
CacheManager::remove() only deleted the original path, leaving the stale
WebP file behind, so callers using the CacheManager API directly could not
clear the WebP cache. Remove the WebP variant alongside the original.

Fixes #1504
…cache

Clear WebP cache variant on CacheManager::remove()
Imagine's FilterInterface::apply() will add a native
\Imagine\Image\ImageInterface return type. Declaring it now on the
RelativeResize implementation silences the forward-compat deprecation
notice emitted when the relative_resize filter is applied.

Fixes #1618
…ize-return-type

Add native return type to RelativeResize::apply()
CacheManager now dispatches a pre and a post event around
CacheManager::store() and CacheManager::remove(), so an application can
react to a cached image being written or deleted without decorating the
cache manager. The store events carry the binary, path, filter and
resolver name; the remove events carry the paths and filters that the
removal applies to.

The legacy-compatible dispatch helper now accepts any event class instead
of only CacheResolveEvent.

Fixes #1280
…cycle-events

Dispatch events on the cache storage lifecycle
* Fall back to the default image when an image cannot be generated

The default image only replaced a source that could not be loaded. An image
the driver fails to process, or a filter set that does not exist, still ended
up as an error page in production.

Outside of debug mode, both now redirect to the default image as well, and the
exception is logged as a warning. The new controller.debug option defaults to
the kernel debug mode, so failures stay visible while developing.
…ency

The documentation had the range the wrong way round: 0 is the transparent end
and 100 the opaque one, and omitting the option leaves the background opaque.

The option is handed straight to the palette as the alpha of the background
color, so the semantics are Imagine's. The filter had no test, so the direction
is pinned by one now.
Fix the documented range of the background filter transparency
Document how asset versioning works with the AssetMapper
* Dispatch filter lifecycle events

* Update changelog

* Make filter event dispatch backward compatible

---------

Co-authored-by: Ben Younes <2910651+ousamabenyounes@users.noreply.github.com>
…lt-image

Return a not found response for a non-existing filter outside of the debug mode
dbu and others added 8 commits November 8, 2026 11:46
The FormatExtensionResolver could only be used by declaring it as a
service by hand. A new FormatExtensionResolverFactory makes it a
regular resolver configuration, decorating another configured resolver:

    liip_imagine:
        resolvers:
            format_extension:
                format_extension:
                    resolver: default

Document it on the resolver page and in the "WebP for all" section,
where the cached images otherwise keep the extension of the source.
…solver-factory

Add a format_extension resolver configuration
…tion of filter set names (#1676)

* Add the normalize_filter_set_names option and deprecate the normalization of filter set names
* Ask for matching filter set names in the configuration and the templates
Brings 2.x from 2.17.1 up to 01f5d62 into the 3.x layout. Merged with
merge.directoryRenames=true so the files added on 2.x land in src/ and
tests/.

Conflict resolutions:
- codestyle-only conflicts (static closures and void return types from
  the 2.x cs-fixer run) keep the stricter 3.x signatures
- files removed in 3.x (AmazonS3Resolver, CacheResolver, enqueue,
  templating, NonFunctionalFilterExceptionPass and their tests) stay
  deleted
- ImagineController keeps the mandatory ControllerConfig and gets the
  optional logger for the default image fallback
- CacheManager dispatches the new store/remove events directly, the
  Symfony < 4.3 BC layer does not exist in 3.x
- FilterManager gets the Vips quality fallback and the filter events
- the 2.x deprecations (normalize_filter_set_names, ...) are kept as they
  are, their cleanup for 3.x is done separately

Adapted to 3.x:
- typed signatures for FormatExtensionResolverFactory, typed properties
  in the new events and the ControllerConfig debug flag
- the new 2.x tests use createMock() instead of the mock helpers removed
  from AbstractTest, and the form theme path in src/Resources

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Amoifr Amoifr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the ping! I went through it:

  • Every 2.x change since the last merge point is in, mapped to the 3.x layout (src/, tests/, doc/). The remaining differences are the 3.x rewrites (typed properties and signatures) and files already removed from 3.x, like FilterExtension (so the Twig 4 fix is moot there).
  • The four declare(strict_types=1) removals come from the "fix codestyle" commit on 2.x, so they look intended.
  • Locally on PHP 8.5: 995 tests green, and PHPStan reports the same errors as on 2-to-3, apart from Imagine\Vips\Imagine not found (rokka/imagine-vips is not installed here; CI is green).

One thing for later rather than for this PR: normalize_filter_set_names and its deprecations now live on the 3.x side, with messages saying the option will be removed in 3.0. Before tagging 3.0 it should go (names used as written), with a BC break entry in UPGRADE.md. Happy to send that PR once this one is in. 👍

@dbu
dbu merged commit e79e8a8 into 2-to-3 Nov 18, 2026
12 checks passed
@dbu
dbu deleted the 2-to-upgrade-branch branch November 18, 2026 19:48
@dbu

dbu commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

thanks. yeah the deprecations should not be fixed in the merge from 2 to 3, but against 3 separately. i will now merge the 2-to-3 branch. do you want to do a PR to remove the deprecations against 3.x? we should repeat in the UPGRADE.m that those deprecated things are now removed, in case people ignored the deprecations.

@Amoifr

Amoifr commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Thanks for merging, @dbu! Sure, I'll open a PR against 3.x that removes normalize_filter_set_names and the normalization, with a BC break entry in UPGRADE.md telling people to drop the option and use their filter set names as written. 🙂

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.

4 participants