Skip to content

v3.0.0

Latest

Choose a tag to compare

@garak garak released this 07 Sep 07:40
97a0aa0

First stable release of the 3.x line. It includes every fix shipped in 2.9.x and 2.10.0.
Upgrading from 2.x: read UPGRADE.md first.
2.x moves to maintenance on the 2.x branch.

Requirements

  • PHP 8.3 or newer. PHP 8.1 and 8.2 are no longer supported.
  • Symfony 6.4, 7.4 or 8.x. Symfony 5.4, 6.0 to 6.3 and 7.0 to 7.3 are no longer supported. (#1558)

Breaking changes

  • Annotations are gone. Only PHP attributes from Vich\UploaderBundle\Mapping\Attribute are supported. The deprecated Mapping\Annotation namespace, AnnotationInterface and the *Annotation() methods of AttributeReader are removed. (#1549, #1556)
  • NamerInterface::name() and DirectoryNamerInterface::directoryName() now take object|array. Custom namers type-hinting object must widen their signature. (#1561)
  • PropertyMappingResolverInterface::resolve() returns PropertyMappingInterface instead of PropertyMapping.
  • PropertyMapping, PropertyMappingFactory, MetadataReader and AttributeReader are final. Extend or mock the new interfaces instead: PropertyMappingInterface, PropertyMappingFactoryInterface, MetadataReaderInterface, UploadHandlerInterface. (#1539, #1565)
  • StorageInterface has a new listFiles(PropertyMappingInterface $mapping): iterable method, used by the cleanup command. Custom storages must implement it. (#1553)
  • Internal services use readonly classes and properties. Subclassing them was never supported and now fails at compile time. (#1568)

New

  • vich:cleanup command removes files in storage that no mapped entity references any more. Ships with --dry-run, a --min-age guard against in-flight uploads and an explicit confirmation step. See docs/command/cleanup.md. (#1553)
  • ChainDirectoryNamer concatenates the output of several directory namers. Empty segments are skipped. See docs/namers.md. (#1570)
  • Unique file names come from Random\Randomizer. (#1568)

Fixes carried over from 2.9.x and 2.10.0

  • Erasing file properties on delete only nulls properties that accept null. Non-nullable typed properties or setters no longer trigger a TypeError. (#1605)
  • resolveUri() normalises slashes between uri_prefix, directory and file name, so a trailing slash in uri_prefix no longer produces //. (#1604)
  • AttributeReader no longer instantiates attributes unrelated to the bundle. (#1603)
  • Concurrent uploads to the same new directory no longer fail on mkdir(). (#1589)
  • PropertyNamer and PropertyDirectoryNamer accept "0" as a value. (#1597)
  • VichFileType: delete_label keeps its own translation domain when download_label is a callable. New options download_label_translation_domain and delete_label_translation_domain. Custom form themes must read download_label_translation_domain instead of translation_domain for the download link. (#1574)
  • MappingCollector no longer breaks the profiler when no mapping data was collected. (#1594)
  • FileExtensionTrait no longer triggers the "null as array offset" deprecation on PHP 8.4. (#1595)

Internals

  • Container configuration is written in PHP instead of XML. (#1554)
  • declare(strict_types=1) removed to match the rest of the Symfony ecosystem. (#1600)
  • Test suite on PHPUnit 12, CI covers PHP 8.3 to 8.5 and Symfony 6.4 to 8.1. (#1560, #1596)

Changes since 3.0.0-rc4

Port of the fixes released on 2.x between 2.9.2 and 2.10.0 (#1574, #1580, #1594, #1595, #1597, #1603, #1604, #1605) and two doc updates (#1571, #1582).

Thanks

@endelwar, @gnat42, @guillaume-sainthillier, @ousamabenyounes, @sabat24, @Tairesh, @ixarlie, @theredled and @garak.

Full Changelog: v2.10.0...v3.0.0