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\Attributeare supported. The deprecatedMapping\Annotationnamespace,AnnotationInterfaceand the*Annotation()methods ofAttributeReaderare removed. (#1549, #1556) NamerInterface::name()andDirectoryNamerInterface::directoryName()now takeobject|array. Custom namers type-hintingobjectmust widen their signature. (#1561)PropertyMappingResolverInterface::resolve()returnsPropertyMappingInterfaceinstead ofPropertyMapping.PropertyMapping,PropertyMappingFactory,MetadataReaderandAttributeReaderarefinal. Extend or mock the new interfaces instead:PropertyMappingInterface,PropertyMappingFactoryInterface,MetadataReaderInterface,UploadHandlerInterface. (#1539, #1565)StorageInterfacehas a newlistFiles(PropertyMappingInterface $mapping): iterablemethod, 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:cleanupcommand removes files in storage that no mapped entity references any more. Ships with--dry-run, a--min-ageguard against in-flight uploads and an explicit confirmation step. See docs/command/cleanup.md. (#1553)ChainDirectoryNamerconcatenates 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 betweenuri_prefix, directory and file name, so a trailing slash inuri_prefixno longer produces//. (#1604)AttributeReaderno longer instantiates attributes unrelated to the bundle. (#1603)- Concurrent uploads to the same new directory no longer fail on
mkdir(). (#1589) PropertyNamerandPropertyDirectoryNameraccept"0"as a value. (#1597)VichFileType:delete_labelkeeps its own translation domain whendownload_labelis a callable. New optionsdownload_label_translation_domainanddelete_label_translation_domain. Custom form themes must readdownload_label_translation_domaininstead oftranslation_domainfor the download link. (#1574)MappingCollectorno longer breaks the profiler when no mapping data was collected. (#1594)FileExtensionTraitno 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