Merge branch '4.3' into 4.4
* 4.3: [Messenger] Removed named parameters and replaced with `?` placeholders for sqlsrv compatibility [HttpClient] use "idle" instead of "inactivity" when telling about the timeout option Create mailBody with only attachments part present [Messenger] Fix incompatibility with FrameworkBundle <4.3.1
This commit is contained in:
commit
8b9de7d967
@ -1365,7 +1365,7 @@ class Configuration implements ConfigurationInterface
|
||||
->info('A comma separated list of hosts that do not require a proxy to be reached.')
|
||||
->end()
|
||||
->floatNode('timeout')
|
||||
->info('Defaults to "default_socket_timeout" ini parameter.')
|
||||
->info('The idle timeout, defaults to the "default_socket_timeout" ini parameter.')
|
||||
->end()
|
||||
->scalarNode('bindto')
|
||||
->info('A network interface name, IP address, a host name or a UNIX socket to bind to.')
|
||||
|
@ -82,7 +82,7 @@
|
||||
</service>
|
||||
|
||||
<service id="console.command.messenger_consume_messages" class="Symfony\Component\Messenger\Command\ConsumeMessagesCommand">
|
||||
<argument type="service" id="messenger.routable_message_bus" />
|
||||
<argument /> <!-- Routable message bus -->
|
||||
<argument type="service" id="messenger.receiver_locator" />
|
||||
<argument type="service" id="logger" on-invalid="null" />
|
||||
<argument type="collection" /> <!-- Receiver names -->
|
||||
|
@ -30,7 +30,7 @@ class ErrorChunk implements ChunkInterface
|
||||
{
|
||||
$this->offset = $offset;
|
||||
$this->error = $error;
|
||||
$this->errorMessage = null !== $error ? $error->getMessage() : 'Reading from the response stream reached the inactivity timeout.';
|
||||
$this->errorMessage = null !== $error ? $error->getMessage() : 'Reading from the response stream reached the idle timeout.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,6 +55,8 @@ class ConsumeMessagesCommand extends Command
|
||||
if ($routableBus instanceof ContainerInterface) {
|
||||
@trigger_error(sprintf('Passing a "%s" instance as first argument to "%s()" is deprecated since Symfony 4.4, pass a "%s" instance instead.', ContainerInterface::class, __METHOD__, RoutableMessageBus::class), E_USER_DEPRECATED);
|
||||
$routableBus = new RoutableMessageBus($routableBus);
|
||||
} elseif (!$routableBus instanceof RoutableMessageBus) {
|
||||
throw new \TypeError(sprintf('The first argument must be an instance of "%s".', RoutableMessageBus::class));
|
||||
}
|
||||
|
||||
if (\is_array($retryStrategyLocator)) {
|
||||
|
@ -251,14 +251,19 @@ class MessengerPass implements CompilerPassInterface
|
||||
$buses[$busId] = new Reference($busId);
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('messenger.routable_message_bus')) {
|
||||
if ($hasRoutableMessageBus = $container->hasDefinition('messenger.routable_message_bus')) {
|
||||
$container->getDefinition('messenger.routable_message_bus')
|
||||
->replaceArgument(0, ServiceLocatorTagPass::register($container, $buses));
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('console.command.messenger_consume_messages')) {
|
||||
$container->getDefinition('console.command.messenger_consume_messages')
|
||||
->replaceArgument(3, array_values($receiverNames));
|
||||
$consumeCommandDefinition = $container->getDefinition('console.command.messenger_consume_messages');
|
||||
|
||||
if ($hasRoutableMessageBus) {
|
||||
$consumeCommandDefinition->replaceArgument(0, new Reference('messenger.routable_message_bus'));
|
||||
}
|
||||
|
||||
$consumeCommandDefinition->replaceArgument(3, array_values($receiverNames));
|
||||
}
|
||||
|
||||
if ($container->hasDefinition('console.command.messenger_setup_transports')) {
|
||||
|
@ -109,19 +109,19 @@ class Connection
|
||||
$queryBuilder = $this->driverConnection->createQueryBuilder()
|
||||
->insert($this->configuration['table_name'])
|
||||
->values([
|
||||
'body' => ':body',
|
||||
'headers' => ':headers',
|
||||
'queue_name' => ':queue_name',
|
||||
'created_at' => ':created_at',
|
||||
'available_at' => ':available_at',
|
||||
'body' => '?',
|
||||
'headers' => '?',
|
||||
'queue_name' => '?',
|
||||
'created_at' => '?',
|
||||
'available_at' => '?',
|
||||
]);
|
||||
|
||||
$this->executeQuery($queryBuilder->getSQL(), [
|
||||
':body' => $body,
|
||||
':headers' => json_encode($headers),
|
||||
':queue_name' => $this->configuration['queue_name'],
|
||||
':created_at' => self::formatDateTime($now),
|
||||
':available_at' => self::formatDateTime($availableAt),
|
||||
$body,
|
||||
json_encode($headers),
|
||||
$this->configuration['queue_name'],
|
||||
self::formatDateTime($now),
|
||||
self::formatDateTime($availableAt),
|
||||
]);
|
||||
|
||||
return $this->driverConnection->lastInsertId();
|
||||
@ -154,12 +154,12 @@ class Connection
|
||||
|
||||
$queryBuilder = $this->driverConnection->createQueryBuilder()
|
||||
->update($this->configuration['table_name'])
|
||||
->set('delivered_at', ':delivered_at')
|
||||
->where('id = :id');
|
||||
->set('delivered_at', '?')
|
||||
->where('id = ?');
|
||||
$now = new \DateTime();
|
||||
$this->executeQuery($queryBuilder->getSQL(), [
|
||||
':id' => $doctrineEnvelope['id'],
|
||||
':delivered_at' => self::formatDateTime($now),
|
||||
self::formatDateTime($now),
|
||||
$doctrineEnvelope['id'],
|
||||
]);
|
||||
|
||||
$this->driverConnection->commit();
|
||||
@ -247,10 +247,10 @@ class Connection
|
||||
}
|
||||
|
||||
$queryBuilder = $this->createQueryBuilder()
|
||||
->where('m.id = :id');
|
||||
->where('m.id = ?');
|
||||
|
||||
$data = $this->executeQuery($queryBuilder->getSQL(), [
|
||||
'id' => $id,
|
||||
$id,
|
||||
])->fetch();
|
||||
|
||||
return false === $data ? null : $this->decodeEnvelopeHeaders($data);
|
||||
@ -262,13 +262,13 @@ class Connection
|
||||
$redeliverLimit = (clone $now)->modify(sprintf('-%d seconds', $this->configuration['redeliver_timeout']));
|
||||
|
||||
return $this->createQueryBuilder()
|
||||
->where('m.delivered_at is null OR m.delivered_at < :redeliver_limit')
|
||||
->andWhere('m.available_at <= :now')
|
||||
->andWhere('m.queue_name = :queue_name')
|
||||
->where('m.delivered_at is null OR m.delivered_at < ?')
|
||||
->andWhere('m.available_at <= ?')
|
||||
->andWhere('m.queue_name = ?')
|
||||
->setParameters([
|
||||
':now' => self::formatDateTime($now),
|
||||
':queue_name' => $this->configuration['queue_name'],
|
||||
':redeliver_limit' => self::formatDateTime($redeliverLimit),
|
||||
self::formatDateTime($redeliverLimit),
|
||||
self::formatDateTime($now),
|
||||
$this->configuration['queue_name'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -421,12 +421,12 @@ class Email extends Message
|
||||
*/
|
||||
private function generateBody(): AbstractPart
|
||||
{
|
||||
if (null === $this->text && null === $this->html) {
|
||||
throw new LogicException('A message must have a text and/or an HTML part.');
|
||||
[$htmlPart, $attachmentParts, $inlineParts] = $this->prepareParts();
|
||||
if (null === $this->text && null === $this->html && !$attachmentParts) {
|
||||
throw new LogicException('A message must have a text or an HTML part or attachments.');
|
||||
}
|
||||
|
||||
$part = null === $this->text ? null : new TextPart($this->text, $this->textCharset);
|
||||
[$htmlPart, $attachmentParts, $inlineParts] = $this->prepareParts();
|
||||
if (null !== $htmlPart) {
|
||||
if (null !== $part) {
|
||||
$part = new AlternativePart($part, $htmlPart);
|
||||
@ -440,7 +440,11 @@ class Email extends Message
|
||||
}
|
||||
|
||||
if ($attachmentParts) {
|
||||
$part = new MixedPart($part, ...$attachmentParts);
|
||||
if ($part) {
|
||||
$part = new MixedPart($part, ...$attachmentParts);
|
||||
} else {
|
||||
$part = new MixedPart(...$attachmentParts);
|
||||
}
|
||||
}
|
||||
|
||||
return $part;
|
||||
|
@ -284,6 +284,10 @@ class EmailTest extends TestCase
|
||||
$e->html('html content');
|
||||
$this->assertEquals(new MixedPart($html, $att), $e->getBody());
|
||||
|
||||
$e = new Email();
|
||||
$e->attach($file);
|
||||
$this->assertEquals(new MixedPart($att), $e->getBody());
|
||||
|
||||
$e = new Email();
|
||||
$e->html('html content');
|
||||
$e->text('text content');
|
||||
|
@ -27,7 +27,7 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
interface ChunkInterface
|
||||
{
|
||||
/**
|
||||
* Tells when the inactivity timeout has been reached.
|
||||
* Tells when the idle timeout has been reached.
|
||||
*
|
||||
* @throws TransportExceptionInterface on a network error
|
||||
*/
|
||||
@ -36,21 +36,21 @@ interface ChunkInterface
|
||||
/**
|
||||
* Tells when headers just arrived.
|
||||
*
|
||||
* @throws TransportExceptionInterface on a network error or when the inactivity timeout is reached
|
||||
* @throws TransportExceptionInterface on a network error or when the idle timeout is reached
|
||||
*/
|
||||
public function isFirst(): bool;
|
||||
|
||||
/**
|
||||
* Tells when the body just completed.
|
||||
*
|
||||
* @throws TransportExceptionInterface on a network error or when the inactivity timeout is reached
|
||||
* @throws TransportExceptionInterface on a network error or when the idle timeout is reached
|
||||
*/
|
||||
public function isLast(): bool;
|
||||
|
||||
/**
|
||||
* Returns the content of the response chunk.
|
||||
*
|
||||
* @throws TransportExceptionInterface on a network error or when the inactivity timeout is reached
|
||||
* @throws TransportExceptionInterface on a network error or when the idle timeout is reached
|
||||
*/
|
||||
public function getContent(): string;
|
||||
|
||||
|
@ -52,7 +52,7 @@ interface HttpClientInterface
|
||||
'resolve' => [], // string[] - a map of host to IP address that SHOULD replace DNS resolution
|
||||
'proxy' => null, // string - by default, the proxy-related env vars handled by curl SHOULD be honored
|
||||
'no_proxy' => null, // string - a comma separated list of hosts that do not require a proxy to be reached
|
||||
'timeout' => null, // float - the inactivity timeout - defaults to ini_get('default_socket_timeout')
|
||||
'timeout' => null, // float - the idle timeout - defaults to ini_get('default_socket_timeout')
|
||||
'bindto' => '0', // string - the interface or the local socket to bind to
|
||||
'verify_peer' => true, // see https://php.net/context.ssl for the following options
|
||||
'verify_host' => true,
|
||||
@ -85,7 +85,7 @@ interface HttpClientInterface
|
||||
* Yields responses chunk by chunk as they complete.
|
||||
*
|
||||
* @param ResponseInterface|ResponseInterface[]|iterable $responses One or more responses created by the current HTTP client
|
||||
* @param float|null $timeout The inactivity timeout before exiting the iterator
|
||||
* @param float|null $timeout The idle timeout before yielding timeout chunks
|
||||
*/
|
||||
public function stream($responses, float $timeout = null): ResponseStreamInterface;
|
||||
}
|
||||
|
Reference in New Issue
Block a user