8000 bug #46538 [FrameworkBundle][HtmlSanitizer] Fix calling `allowStaticE… · symfony/symfony@3c4bc1d · GitHub
[go: up one dir, main page]

Skip to content

Commit 3c4bc1d

Browse files
committed
bug #46538 [FrameworkBundle][HtmlSanitizer] Fix calling allowStaticElements when setting allow_all_static_elements: true (norkunas)
This PR was merged into the 6.1 branch. Discussion ---------- [FrameworkBundle][HtmlSanitizer] Fix calling `allowStaticElements` when setting `allow_all_static_elements: true` | Q | A | ------------- | --- | Branch? | 6.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | [symfony/symfony-docs#... <!-- required for new features -->](symfony/symfony-docs#16838) ``` Symfony\Component\ErrorHandler\Error\UndefinedMethodError {#21964 #message: """ Attempted to call an undefined method named "allowAllStaticElements" of class "Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig".\n Did you mean to call e.g. "allowSafeElements" or "allowStaticElements"? """ #code: 0 #file: "./var/cache/dev/ContainerXJ5lfcV/getHtmlSanitizer_Sanitizer_PostContent_SanitizerService.php" #line: 25 trace: { ./var/cache/dev/ContainerXJ5lfcV/getHtmlSanitizer_Sanitizer_PostContent_SanitizerService.php:25 { ContainerXJ5lfcV\getHtmlSanitizer_Sanitizer_PostContent_SanitizerService::do($container, $lazyLoad = true) › $a = new \Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig(); › $a = $a->allowAllStaticElements(); › $a = $a->forceHttpsUrls(false); } ./var/cache/dev/ContainerXJ5lfcV/App_KernelDevDebugContainer.php:981 { …} ./var/cache/dev/ContainerXJ5lfcV/getTestCommandService.php:23 { …} ./var/cache/dev/ContainerXJ5lfcV/App_KernelDevDebugContainer.php:981 { …} ./vendor/symfony/dependency-injection/Container.php:383 { …} ./vendor/symfony/dependency-injection/Argument/ServiceLocator.php:43 { …} ./vendor/symfony/console/CommandLoader/ContainerCommandLoader.php:46 { …} ./vendor/symfony/console/Application.php:570 { …} ./vendor/symfony/console/Application.php:657 { …} ./vendor/symfony/framework-bundle/Console/Application.php:114 { …} ./vendor/symfony/console/Application.php:259 { …} ./vendor/symfony/framework-bundle/Console/Application.php:80 { …} ./vendor/symfony/console/Application.php:171 { …} ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54 { …} ./vendor/autoload_runtime.php:29 { …} ./bin/console:15 { …} } } ``` Commits ------- 98a4b8a [HtmlSanitizer][FrameworkBundle] Fix calling `allowStaticElements` when setting `allow_all_static_elements: true`
2 parents 786e71c + 98a4b8a commit 3c4bc1d

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2149,7 +2149,7 @@ private function addHtmlSanitizerSection(ArrayNodeDefinition $rootNode, callable
21492149
->info('Allows "safe" elements and attributes.')
21502150
->defaultFalse()
21512151
->end()
2152-
->booleanNode('allow_all_static_elements')
2152+
->booleanNode('allow_static_elements')
21532153
->info('Allows all static elements and attributes from the W3C Sanitizer API standard.')
21542154
->defaultFalse()
21552155
->end()

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,8 +2682,8 @@ private function registerHtmlSanitizerConfiguration(array $config, ContainerBuil
26822682
$def->addMethodCall('allowSafeElements', [], true);
26832683
}
26842684

2685-
if ($sanitizerConfig['allow_all_static_elements']) {
2686-
$def->addMethodCall('allowAllStaticElements', [], true);
2685+
if ($sanitizerConfig['allow_static_elements']) {
2686+
$def->addMethodCall('allowStaticElements', [], true);
26872687
}
26882688

26892689
// Configures elements

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@
845845
</xsd:sequence>
846846
<xsd:attribute name="name" type="xsd:string" use="required" />
847847
<xsd:attribute name="allow-safe-elements" type="xsd:boolean" />
848-
<xsd:attribute name="allow-all-static-elements" type="xsd:boolean" />
848+
<xsd:attribute name="allow-static-elements" type="xsd:boolean" />
849849
<xsd:attribute name="force-https-urls" type="xsd:boolean" />
850850
<xsd:attribute name="allow-relative-links" type="xsd:boolean" />
851851
<xsd:attribute name="allow-relative-medias" type="xsd:boolean" />

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/html_sanitizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'sanitizers' => [
77
'default' => [
88
'allow_safe_elements' => true,
9-
'allow_all_static_elements' => true,
9+
'allow_static_elements' => true,
1010
'allow_elements' => [
1111
'iframe' => 'src',
1212
'custom-tag' => ['data-attr', 'data-attr-1'],

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/html_sanitizer.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<html-sanitizer>
1010
<sanitizer name="default"
1111
allow-safe-elements="true"
12-
allow-all-static-elements="true"
12+
allow-static-elements="true"
1313
force-https-urls="true"
1414
allow-relative-links="true"
1515
allow-relative-medias="true"

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/html_sanitizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ framework:
44
sanitizers:
55
default:
66
allow_safe_elements: true
7-
allow_all_static_elements: true
7+
allow_static_elements: true
88
allow_elements:
99
iframe: 'src'
1010
custom-tag: ['data-attr', 'data-attr-1']

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2045,7 +2045,7 @@ public function testHtmlSanitizer()
20452045
$this->assertSame(
20462046
[
20472047
['allowSafeElements', [], true],
2048-
['allowAllStaticElements', [], true],
2048+
['allowStaticElements', [], true],
20492049
['allowElement', ['iframe', 'src'], true],
20502050
['allowElement', ['custom-tag', ['data-attr', 'data-attr-1']], true],
20512051
['allowElement', ['custom-tag-2', '*'], true],

0 commit comments

Comments
 (0)
0