From b90c82549e6ed62498cf8346ee463184a0d4e9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Brajkovi=C4=87?= Date: Tue, 29 Sep 2026 20:16:17 +0200 Subject: [PATCH 1/4] remove composer conflit and add runtime check for deepclone extension --- composer.json | 1 - src/Attribute/PurgeOn.php | 10 ++++++++-- src/Attribute/RouteParamValue/DynamicValues.php | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 7e4b926b..feb7c104 100644 --- a/composer.json +++ b/composer.json @@ -69,7 +69,6 @@ "symfony/yaml": "To configure purge subscriptions using YAML files" }, "conflict": { - "ext-deepclone": "<0.7.1", "symfony/cache": "<6.4", "symfony/expression-language": "<6.4", "symfony/http-client": "<6.4", diff --git a/src/Attribute/PurgeOn.php b/src/Attribute/PurgeOn.php index 97871073..5dbaf80c 100644 --- a/src/Attribute/PurgeOn.php +++ b/src/Attribute/PurgeOn.php @@ -41,8 +41,14 @@ public function __construct( string|array|null $route = null, string|array|Action|null $actions = null, ) { - if ($if instanceof \Closure && !\function_exists('deepclone_to_array')) { - throw new LogicException('You cannot use a closure for the "if" attribute because DeepClone is not installed. Try running "composer require symfony/polyfill-deepclone" or "pie install symfony/deepclone".'); + if ($if instanceof \Closure) { + if (!\function_exists('deepclone_to_array')) { + throw new LogicException('You cannot use a closure for the "if" attribute because DeepClone is not installed. Try running "composer require symfony/polyfill-deepclone" or "pie install symfony/deepclone".'); + } + + if (\extension_loaded('deepclone') && version_compare((string) phpversion('deepclone'), '0.7.1', '<')) { + throw new LogicException('You cannot use a closure for the "if" attribute because the DeepClone extension is too old. Upgrade it to 0.7.1 or higher.'); + } } $this->target = \is_array($target) || \is_string($target) ? new ForProperties($target) : $target; diff --git a/src/Attribute/RouteParamValue/DynamicValues.php b/src/Attribute/RouteParamValue/DynamicValues.php index f97cee2f..de834f99 100644 --- a/src/Attribute/RouteParamValue/DynamicValues.php +++ b/src/Attribute/RouteParamValue/DynamicValues.php @@ -48,6 +48,10 @@ private static function normalizeProvider(string|array|\Closure $provider): stri throw new LogicException('You cannot use a closure as a "DynamicValues" provider because DeepClone is not installed. Try running "composer require symfony/polyfill-deepclone" or "pie install symfony/deepclone".'); } + if (\extension_loaded('deepclone') && version_compare((string) phpversion('deepclone'), '0.7.1', '<')) { + throw new LogicException('You cannot use a closure as a "DynamicValues" provider because the DeepClone extension is too old. Upgrade it to 0.7.1 or higher.'); + } + return $provider; } From e7cec4b4e6f47399d8782961d75109dfd265b8eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Brajkovi=C4=87?= Date: Tue, 29 Sep 2026 20:26:18 +0200 Subject: [PATCH 2/4] update docs --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 3425a77e..e323b257 100644 --- a/docs/README.md +++ b/docs/README.md @@ -464,7 +464,7 @@ composer require symfony/polyfill-deepclone ``` For better performance, you can instead install the [PHP extension](https://github.com/symfony/php-ext-deepclone) -with [PIE](https://github.com/php/pie): +(version 0.7.1 or higher) with [PIE](https://github.com/php/pie): ```sh pie install symfony/deepclone From d0126ef7031a125766e2fb5f02a894bdfd814f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Brajkovi=C4=87?= Date: Tue, 29 Sep 2026 20:37:24 +0200 Subject: [PATCH 3/4] minor tweak --- src/Attribute/PurgeOn.php | 2 +- src/Attribute/RouteParamValue/DynamicValues.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Attribute/PurgeOn.php b/src/Attribute/PurgeOn.php index 5dbaf80c..972e1026 100644 --- a/src/Attribute/PurgeOn.php +++ b/src/Attribute/PurgeOn.php @@ -46,7 +46,7 @@ public function __construct( throw new LogicException('You cannot use a closure for the "if" attribute because DeepClone is not installed. Try running "composer require symfony/polyfill-deepclone" or "pie install symfony/deepclone".'); } - if (\extension_loaded('deepclone') && version_compare((string) phpversion('deepclone'), '0.7.1', '<')) { + if (false !== ($version = phpversion('deepclone')) && version_compare($version, '0.7.1', '<')) { throw new LogicException('You cannot use a closure for the "if" attribute because the DeepClone extension is too old. Upgrade it to 0.7.1 or higher.'); } } diff --git a/src/Attribute/RouteParamValue/DynamicValues.php b/src/Attribute/RouteParamValue/DynamicValues.php index de834f99..acb2c85d 100644 --- a/src/Attribute/RouteParamValue/DynamicValues.php +++ b/src/Attribute/RouteParamValue/DynamicValues.php @@ -48,7 +48,7 @@ private static function normalizeProvider(string|array|\Closure $provider): stri throw new LogicException('You cannot use a closure as a "DynamicValues" provider because DeepClone is not installed. Try running "composer require symfony/polyfill-deepclone" or "pie install symfony/deepclone".'); } - if (\extension_loaded('deepclone') && version_compare((string) phpversion('deepclone'), '0.7.1', '<')) { + if (false !== ($version = phpversion('deepclone')) && version_compare($version, '0.7.1', '<')) { throw new LogicException('You cannot use a closure as a "DynamicValues" provider because the DeepClone extension is too old. Upgrade it to 0.7.1 or higher.'); } From b1018aa856bd891ca6c83c0dd0f6d4e709ab9e4a Mon Sep 17 00:00:00 2001 From: HypeMC Date: Tue, 29 Sep 2026 20:49:09 +0200 Subject: [PATCH 4/4] Changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3575abe7..31cf8963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.1] - 2026-09-29 + +### Fixed + +- Fix installation alongside `symfony/polyfill-deepclone`, the DeepClone extension version is now checked at runtime + instead of through a Composer conflict by @Brajk19 in https://github.com/sofascore/purgatory-bundle/pull/172 + ## [2.0.0] - 2026-09-29 ### Added @@ -148,6 +155,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Initial release +[2.0.1]: https://github.com/sofascore/purgatory-bundle/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/sofascore/purgatory-bundle/compare/v1.6.0...v2.0.0 [1.6.0]: https://github.com/sofascore/purgatory-bundle/compare/v1.5.0...v1.6.0 [1.5.0]: https://github.com/sofascore/purgatory-bundle/compare/v1.4.0...v1.5.0