diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md
index e13d9b7feb..34786d5464 100644
--- a/UPGRADE-3.4.md
+++ b/UPGRADE-3.4.md
@@ -16,6 +16,8 @@ Finder
FrameworkBundle
---------------
+ * The `validator.mapping.cache.doctrine.apc` service has been deprecated.
+
* Using the `KERNEL_DIR` environment variable or the automatic guessing based
on the `phpunit.xml` / `phpunit.xml.dist` file location is deprecated since 3.4.
Set the `KERNEL_CLASS` environment variable to the fully-qualified class name
diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md
index fce693437f..f6547fd0a0 100644
--- a/UPGRADE-4.0.md
+++ b/UPGRADE-4.0.md
@@ -227,6 +227,8 @@ Form
FrameworkBundle
---------------
+ * The `validator.mapping.cache.doctrine.apc` service has been removed.
+
* The `cache:clear` command does not warmup the cache anymore. Warmup should
be done via the `cache:warmup` command.
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 611bfad97d..350d632741 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -661,7 +661,18 @@ class Configuration implements ConfigurationInterface
->info('validation configuration')
->{!class_exists(FullStack::class) && class_exists(Validation::class) ? 'canBeDisabled' : 'canBeEnabled'}()
->children()
- ->scalarNode('cache')->end()
+ ->scalarNode('cache')
+ ->beforeNormalization()
+ // Can be removed in 4.0, when validator.mapping.cache.apc is removed
+ ->ifString()->then(function ($v) {
+ if ('validator.mapping.cache.apc' === $v && !class_exists('Doctrine\Common\Cache\ApcCache')) {
+ throw new LogicException('Doctrine APC cache for the validator cannot be enabled as the Doctrine Cache package is not installed.');
+ }
+
+ return $v;
+ })
+ ->end()
+ ->end()
->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && class_exists(Annotation::class) ? 'defaultTrue' : 'defaultFalse'}()->end()
->arrayNode('static_method')
->defaultValue(array('loadValidatorMetadata'))
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
index 5f505e859c..aa472d380c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
@@ -57,6 +57,7 @@
+ The "%service_id%" service is deprecated since Symfony 3.4 and will be removed in 4.0. Use a Psr6 cache like "validator.mapping.cache.symfony" instead.