Skip to content

Commit

Permalink
Merge branch '5.4' into 6.0
Browse files Browse the repository at this point in the history
* 5.4:
  [Mime] Relaxing in-reply-to header validation
  [WebProfilerBundle] fix Email HTML preview
  fix test to actually use data provider
  • Loading branch information
derrabus committed Dec 22, 2021
2 parents 33399e6 + d17ae34 commit de9b7e5
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

$container->loadFromExtension('framework', [
'cache' => [
'app' => 'cache.redis_tag_aware.bar',
'app' => 'cache.redis_tag_aware.foo',
'pools' => [
'cache.redis_tag_aware.foo' => [
'adapter' => 'cache.adapter.redis_tag_aware',
],
'cache.redis_tag_aware.bar' => [
'adapter' => 'cache.redis_tag_aware.foo',
],
],
],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

<framework:config>
<framework:cache>
<framework:app>cache.redis_tag_aware.bar</framework:app>
<framework:app>cache.redis_tag_aware.foo</framework:app>
<framework:pool name="cache.redis_tag_aware.foo" adapter="cache.adapter.redis_tag_aware" />
<framework:pool name="cache.redis_tag_aware.bar" adapter="cache.redis_tag_aware.foo" />
</framework:cache>
</framework:config>
</container>
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
framework:
cache:
app: cache.redis_tag_aware.bar
app: cache.redis_tag_aware.foo
pools:
cache.redis_tag_aware.foo:
adapter: cache.adapter.redis_tag_aware
cache.redis_tag_aware.bar:
adapter: cache.redis_tag_aware.foo
Original file line number Diff line number Diff line change
Expand Up @@ -1589,11 +1589,11 @@ public function testRedisTagAwareAdapter()
}

/**
* @dataProvider testAppRedisTagAwareConfigProvider
* @dataProvider appRedisTagAwareConfigProvider
*/
public function testAppRedisTagAwareAdapter()
public function testAppRedisTagAwareAdapter(string $configFile)
{
$container = $this->createContainerFromFile('cache_app_redis_tag_aware');
$container = $this->createContainerFromFile($configFile);

foreach ([TagAwareCacheInterface::class, CacheInterface::class, CacheItemPoolInterface::class] as $alias) {
$def = $container->findDefinition($alias);
Expand All @@ -1606,7 +1606,7 @@ public function testAppRedisTagAwareAdapter()
}
}

public function testAppRedisTagAwareConfigProvider(): array
public function appRedisTagAwareConfigProvider(): array
{
return [
['cache_app_redis_tag_aware'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,42 +141,48 @@
</div>
{% if message.htmlBody is defined %}
{# Email instance #}
<div class="tab">
<h3 class="tab-title">HTML preview</h3>
<div class="tab-content">
<pre class="prewrap" style="max-height: 600px">
<iframe
src="data:text/html;base64;charset=utf-8,{{ collector.base64Encode(message.htmlBody()) }}"
style="height: 80vh;width: 100%;"
>
</iframe>
</pre>
{% set htmlBody = message.htmlBody() %}
{% if htmlBody is not null %}
<div class="tab">
<h3 class="tab-title">HTML Preview</h3>
<div class="tab-content">
<pre class="prewrap" style="max-height: 600px">
<iframe
src="data:text/html;charset=utf-8;base64,{{ collector.base64Encode(htmlBody) }}"
style="height: 80vh;width: 100%;"
>
</iframe>
</pre>
</div>
</div>
</div>
<div class="tab">
<h3 class="tab-title">HTML Content</h3>
<div class="tab-content">
<pre class="prewrap" style="max-height: 600px">
{%- if message.htmlCharset() %}
{{- message.htmlBody()|convert_encoding('UTF-8', message.htmlCharset()) }}
{%- else %}
{{- message.htmlBody() }}
{%- endif -%}
</pre>
<div class="tab">
<h3 class="tab-title">HTML Content</h3>
<div class="tab-content">
<pre class="prewrap" style="max-height: 600px">
{%- if message.htmlCharset() %}
{{- htmlBody|convert_encoding('UTF-8', message.htmlCharset()) }}
{%- else %}
{{- htmlBody }}
{%- endif -%}
</pre>
</div>
</div>
</div>
<div class="tab">
<h3 class="tab-title">Text Content</h3>
<div class="tab-content">
<pre class="prewrap" style="max-height: 600px">
{%- if message.textCharset() %}
{{- message.textBody()|convert_encoding('UTF-8', message.textCharset()) }}
{%- else %}
{{- message.textBody() }}
{%- endif -%}
</pre>
{% endif %}
{% set textBody = message.textBody() %}
{% if textBody is not null %}
<div class="tab">
<h3 class="tab-title">Text Content</h3>
<div class="tab-content">
<pre class="prewrap" style="max-height: 600px">
{%- if message.textCharset() %}
{{- textBody|convert_encoding('UTF-8', message.textCharset()) }}
{%- else %}
{{- textBody }}
{%- endif -%}
</pre>
</div>
</div>
</div>
{% endif %}
{% for attachment in message.attachments %}
<div class="tab">
<h3 class="tab-title">Attachment #{{ loop.index }}</h3>
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Mime/Header/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ final class Headers
'cc' => MailboxListHeader::class,
'bcc' => MailboxListHeader::class,
'message-id' => IdentificationHeader::class,
'in-reply-to' => IdentificationHeader::class,
'references' => IdentificationHeader::class,
'in-reply-to' => UnstructuredHeader::class, // `In-Reply-To` and `References` are less strict than RFC 2822 (3.6.4) to allow users entering the original email's ...
'references' => UnstructuredHeader::class, // ... `Message-ID`, even if that is no valid `msg-id`
'return-path' => PathHeader::class,
];

Expand Down
14 changes: 14 additions & 0 deletions src/Symfony/Component/Mime/Tests/Header/HeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,20 @@ public function testToArray()
], $headers->toArray());
}

public function testInReplyToAcceptsNonIdentifierValues()
{
$headers = new Headers();
$headers->addHeader('In-Reply-To', 'foobar');
$this->assertEquals('foobar', $headers->get('In-Reply-To')->getBody());
}

public function testReferencesAcceptsNonIdentifierValues()
{
$headers = new Headers();
$headers->addHeader('References' , 'foobar');
$this->assertEquals('foobar', $headers->get('References')->getBody());
}

public function testHeaderBody()
{
$headers = new Headers();
Expand Down

0 comments on commit de9b7e5

Please sign in to comment.