Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0c28d75

Browse filesBrowse files
committed
bug #16822 [FrameworkBundle][Validator] Fix apc cache service deprecation (ogizanagi)
This PR was merged into the 2.8 branch. Discussion ---------- [FrameworkBundle][Validator] Fix apc cache service deprecation | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Related to #16795 I guess the deprecation was on the wrong service. Also, no deprecation notice was triggered about using `"apc"` as the value of the `framework.validation.cache` configuration option. This PR adds the missing deprecation. > 📝 _NOTE_: The standard edition will need to be updated [here](https://github.com/symfony/symfony-standard/blob/2.8/app/config/config_prod.yml#L6). Commits ------- 907bbec [FrameworkBundle][Validator] Fix apc cache service deprecation
2 parents 9efa223 + 907bbec commit 0c28d75
Copy full SHA for 0c28d75

File tree

Expand file treeCollapse file tree

8 files changed

+57
-6
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+57
-6
lines changed

‎UPGRADE-2.8.md

Copy file name to clipboardExpand all lines: UPGRADE-2.8.md
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,28 @@ FrameworkBundle
506506
cookie_httponly: false
507507
```
508508
509+
* The `validator.mapping.cache.apc` service is deprecated, and will be removed in 3.0.
510+
Use `validator.mapping.cache.doctrine.apc` instead.
511+
512+
* The ability to pass `apc` as the `framework.validation.cache` configuration key value is deprecated,
513+
and will be removed in 3.0. Use `validator.mapping.cache.doctrine.apc` instead:
514+
515+
Before:
516+
517+
```yaml
518+
framework:
519+
validation:
520+
cache: apc
521+
```
522+
523+
After:
524+
525+
```yaml
526+
framework:
527+
validation:
528+
cache: validator.mapping.cache.doctrine.apc
529+
```
530+
509531
Security
510532
--------
511533

‎UPGRADE-3.0.md

Copy file name to clipboardExpand all lines: UPGRADE-3.0.md
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,27 @@ UPGRADE FROM 2.x to 3.0
744744
interface.
745745
The `security.csrf.token_manager` should be used instead.
746746

747+
* The `validator.mapping.cache.apc` service has been removed in favor of the `validator.mapping.cache.doctrine.apc` one.
748+
749+
* The ability to pass `apc` as the `framework.validation.cache` configuration key value has been removed.
750+
Use `validator.mapping.cache.doctrine.apc` instead:
751+
752+
Before:
753+
754+
```yaml
755+
framework:
756+
validation:
757+
cache: apc
758+
```
759+
760+
After:
761+
762+
```yaml
763+
framework:
764+
validation:
765+
cache: validator.mapping.cache.doctrine.apc
766+
```
767+
747768
### HttpKernel
748769

749770
* The `Symfony\Component\HttpKernel\Log\LoggerInterface` has been removed in

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,15 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
645645
->scalarNode('cache')
646646
->beforeNormalization()
647647
// Can be removed in 3.0, once ApcCache support is dropped
648-
->ifString()->then(function ($v) { return 'apc' === $v ? 'validator.mapping.cache.apc' : $v; })
648+
->ifString()->then(function ($v) {
649+
if ('apc' === $v) {
650+
@trigger_error('The ability to pass "apc" as the framework.validation.cache configuration key value is deprecated since version 2.8 and will be removed in 3.0. Use the "validator.mapping.cache.doctrine.apc" service id instead.', E_USER_DEPRECATED);
651+
652+
return 'validator.mapping.cache.apc';
653+
}
654+
655+
return $v;
656+
})
649657
->end()
650658
->end()
651659
->booleanNode('enable_annotations')->defaultFalse()->end()

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
<service id="validator.mapping.cache.apc" class="%validator.mapping.cache.apc.class%" public="false">
3939
<argument>%validator.mapping.cache.prefix%</argument>
40+
<deprecated>The "%service_id%" service is deprecated since Symfony 2.5 and will be removed in 3.0.</deprecated>
4041
</service>
4142

4243
<service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache" public="false">
@@ -47,7 +48,6 @@
4748
</call>
4849
</service>
4950
</argument>
50-
<deprecated>The "%service_id%" service is deprecated since Symfony 2.8 and will be removed in 3.0.</deprecated>
5151
</service>
5252

5353
<service id="validator.validator_factory" class="%validator.validator_factory.class%" public="false">

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
),
5656
'validation' => array(
5757
'enabled' => true,
58-
'cache' => 'apc',
58+
'cache' => 'validator.mapping.cache.doctrine.apc',
5959
),
6060
'annotations' => array(
6161
'cache' => 'file',

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<framework:translator enabled="true" fallback="fr" logging="true">
3838
<framework:path>%kernel.root_dir%/Fixtures/translations</framework:path>
3939
</framework:translator>
40-
<framework:validation enabled="true" cache="apc" />
40+
<framework:validation enabled="true" cache="validator.mapping.cache.doctrine.apc" />
4141
<framework:annotations cache="file" debug="true" file-cache-dir="%kernel.cache_dir%/annotations" />
4242
<framework:serializer enabled="true" enable-annotations="true" cache="serializer.mapping.cache.apc" name-converter="serializer.name_converter.camel_case_to_snake_case" />
4343
</framework:config>

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ framework:
4343
paths: ['%kernel.root_dir%/Fixtures/translations']
4444
validation:
4545
enabled: true
46-
cache: apc
46+
cache: validator.mapping.cache.doctrine.apc
4747
annotations:
4848
cache: file
4949
debug: true

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public function testValidation()
295295
$this->assertSame('addMethodMapping', $calls[4][0]);
296296
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
297297
$this->assertSame('setMetadataCache', $calls[5][0]);
298-
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
298+
$this->assertEquals(array(new Reference('validator.mapping.cache.doctrine.apc')), $calls[5][1]);
299299
}
300300

301301
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.