8000 Merge branch '4.4' into 5.1 · symfony/symfony@eec66a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit eec66a2

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: [Mailer] Fixed mandrill api header structure [HttpClient][ResponseTrait] Fix typo [Mailer] Reorder headers used to determine Sender [Validator] Add Lithuanian translation for ISIN constraint
2 parents 91dc9c7 + 9ab652d commit eec66a2

File tree

6 files changed

+33
-11
lines changed

6 files changed

+33
-11
lines changed

src/Symfony/Component/HttpClient/Response/ResponseTrait.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public static function stream(iterable $responses, float $timeout = null): \Gene
316316
}
317317

318318
$lastActivity = microtime(true);
319-
$enlapsedTimeout = 0;
319+
$elapsedTimeout = 0;
320320

321321
while (true) {
322322
$hasActivity = false;
@@ -338,15 +338,15 @@ public static function stream(iterable $responses, float $timeout = null): \Gene
338338
} elseif (!isset($multi->openHandles[$j])) {
339339
unset($responses[$j]);
340340
continue;
341-
} elseif ($enlapsedTimeout >= $timeoutMax) {
341+
} elseif ($elapsedTimeout >= $timeoutMax) {
342342
$multi->handlesActivity[$j] = [new ErrorChunk($response->offset, sprintf('Idle timeout reached for "%s".', $response->getInfo('url')))];
343343
} else {
344344
continue;
345345
}
346346

347347
while ($multi->handlesActivity[$j] ?? false) {
348348
$hasActivity = true;
349-
$enlapsedTimeout = 0;
349+
$elapsedTimeout = 0;
350350

351351
if (\is_string($chunk = array_shift($multi->handlesActivity[$j]))) {
352352
if (null !== $response->inflate && false === $chunk = @inflate_add($response->inflate, $chunk)) {
@@ -380,7 +380,7 @@ public static function stream(iterable $responses, float $timeout = null): \Gene
380380
}
381381
} elseif ($chunk instanceof ErrorChunk) {
382382
unset($responses[$j]);
383-
$enlapsedTimeout = $timeoutMax;
383+
$elapsedTimeout = $timeoutMax;
384384
} elseif ($chunk instanceof FirstChunk) {
385385
if ($response->logger) {
386386
$info = $response->getInfo();
@@ -448,11 +448,11 @@ public static function stream(iterable $responses, float $timeout = null): \Gene
448448
continue;
449449
}
450450

451-
if (-1 === self::select($multi, min($timeoutMin, $timeoutMax - $enlapsedTimeout))) {
451+
if (-1 === self::select($multi, min($timeoutMin, $timeoutMax - $elapsedTimeout))) {
452452
usleep(min(500, 1E6 * $timeoutMin));
453453
}
454454

455-
$enlapsedTimeout = microtime(true) - $lastActivity;
455+
$elapsedTimeout = microtime(true) - $lastActivity;
456456
}
457457
}
458458
}

src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillApiTransportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testCustomHeader()
6565
$this->assertArrayHasKey('message', $payload);
6666
$this->assertArrayHasKey('headers', $payload['message']);
6767
$this->assertCount(1, $payload['message']['headers']);
68-
$this->assertEquals('foo: bar', $payload['message']['headers'][0]);
68+
$this->assertEquals('bar', $payload['message']['headers']['foo']);
6969
}
7070

7171
public function testSend()

src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private function getPayload(Email $email, Envelope $envelope): array
125125
continue;
126126
}
127127

128-
$payload['message']['headers'][] = $name.': '.$header->getBodyAsString();
128+
$payload['message']['headers'][$name] = $header->getBodyAsString();
129129
}
130130

131131
return $payload;

src/Symfony/Component/Mailer/DelayedEnvelope.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ private static function getRecipientsFromHeaders(Headers $headers): array
8383

8484
private static function getSenderFromHeaders(Headers $headers): Address
8585
{
86-
if ($return = $headers->get('Return-Path')) {
87-
return $return->getAddress();
88-
}
8986
if ($sender = $headers->get('Sender')) {
9087
return $sender->getAddress();
9188
}
9289
if ($from = $headers->get('From')) {
9390
return $from->getAddresses()[0];
9491
}
92+
if ($return = $headers->get('Return-Path')) {
93+
return $return->getAddress();
94+
}
9595

9696
throw new LogicException('Unable to determine the sender of the message.');
9797
}

src/Symfony/Component/Mailer/Tests/EnvelopeTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ public function testSenderFromHeadersWithoutFrom F438 ()
8181
$this->assertEquals($from, $e->getSender());
8282
}
8383

84+
public function testSenderFromHeadersWithMulitpleHeaders()
85+
{
86+
$headers = new Headers();
87+
$headers->addMailboxListHeader('From', [$from = new Address('from@symfony.com', 'from'), 'some@symfony.com']);
88+
$headers->addPathHeader('Return-Path', $return = new Address('return@symfony.com', 'return'));
89+
$headers->addMailboxHeader('Sender', $sender = new Address('sender@symfony.com', 'sender'));
90+
$headers->addMailboxListHeader('To', ['to@symfony.com']);
91+
$e = Envelope::create(new Message($headers));
92+
$this->assertEquals($sender, $e->getSender());
93+
94+
$headers = new Headers();
95+
$headers->addMailboxListHeader('From', [$from = new Address('from@symfony.com', 'from'), 'some@symfony.com']);
96+
$headers->addPathHeader('Return-Path', $return = new Address('return@symfony.com', 'return'));
97+
$headers->addMailboxListHeader('To', ['to@symfony.com']);
98+
$e = Envelope::create(new Message($headers));
99+
$this->assertEquals($from, $e->getSender());
100+
}
101+
84102
public function testRecipientsFromHeaders()
85103
{
86104
$headers = new Headers();

src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@
382382
<source>Each element of this collection should satisfy its own set of constraints.</source>
383383
<target>Kiekvienas šio sąrašo elementas turi atitikti savo nurodymų rinkinį.</target>
384384
</trans-unit>
385+
<trans-unit id="99">
386+
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
387+
<target>Ši reišmė neatitinka tarptautinio vertybinių popierių identifikavimo numerio formato (ISIN).</target>
388+
</trans-unit>
385389
</body>
386390
</file>
387391
</xliff>

0 commit comments

Comments
 (0)
0