Install
Works with Drupal: ^10.1 || ^11 || ^12Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
Adds Drupal 12 support and converts the hook implementations to the current core APIs. No backwards compatibility breaks.
Drupal 12 compatibility
- Drupal 12 support. The module installs and runs on Drupal 12. Verified against Drupal 10.6.15, 11.4.5 and 12.0-dev, with the full test suite of 118 tests passing on all three, and with a live Varnish in front of Drupal 12.
- Hook implementations converted to classes. The hooks now live in
src/Hook/using the#[Hook]attribute, which Drupal 12 requires. The procedural implementations inadv_varnish.moduleare kept behind#[LegacyHook]and delegate to those classes, so behaviour is unchanged on Drupal 10 and 11. hook_requirements()converted. The BigPipe conflict check is now implemented ashook_runtime_requirements(), and the procedural version is marked#[LegacyRequirementsHook]. Without this the check would stop working in Drupal 13.- Requirement severity.
REQUIREMENT_ERRORis replaced withRequirementSeverity::ErrorthroughDeprecationHelper, so both constants work on the core version that has them.
Based on the Project Update Bot patch in #3595161: Automated Drupal 12 compatibility fixes for adv_varnish 4.0.15.
Changed requirements
The minimum core version is now Drupal 10.1. core_version_requirement changed from ^9 || ^10 || ^11 to ^10.1 || ^11 || ^12. Only unsupported core versions were dropped: Drupal 9 reached end of life in November 2023, and Drupal 10.0 is no longer supported either. Every supported Drupal 10 and 11 release keeps working. The new lower bound is 10.1 because DeprecationHelper was introduced there.
Bug fixes
- A deprecation was emitted on every request on Drupal 10.3 and later. The event subscriber decided how to call its parent constructor based on Drupal 11.0, but the time service became a constructor argument of
FinishResponseSubscriberin Drupal 10.3. On 10.3 through 10.6 the debug headers flag was passed into the time argument instead. The version boundary is corrected. - Varnish server addresses without a scheme caused Guzzle exceptions. Addresses configured without
http://orhttps://now get the scheme prepended before the request is made, which Guzzle 7.11 started rejecting.
Code quality
- The hook classes use dependency injection instead of static
\Drupal::calls, and the hook services are declared with explicit arguments so that the container builds identically on every supported core version. hook_entity_type_alter()andhook_theme()live in a separate dependency free class. Both run while entity type and theme definitions are still being built, so a hook class with injected services would produce a circular service reference.- Unit tests use test stubs where no expectations are configured.
- PHPStan, PHPCS, CSpell and ESLint all pass with no findings, on all three supported core versions.
Backwards compatibility
This release contains no backwards compatibility breaks.
- No public method signature changed. The missing return type deprecations reported by Drupal 12 are suppressed with
@returnannotations rather than native types, so classes such asCacheBlockFormandUserBlockBasecan still be extended by subclasses that do not declare a return type. - The procedural hook implementations in
adv_varnish.moduleare still in place. ClearCacheForm::$cacheManagerchanged fromprivatetoprotected, which only widens access.