Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
442970b
[JsonPath] Always use brackets notation with `JsonPath::key()`
alexandre-daubois Jun 3, 2025
e9eb3e7
bug #60668 [JsonPath] Always use brackets notation with `JsonPath::ke…
nicolas-grekas Jun 4, 2025
8092ffd
[Security] Keep roles when serializing tokens
nicolas-grekas Jun 4, 2025
42e5ad5
bug #60688 [Security] Keep roles when serializing tokens (nicolas-gre…
nicolas-grekas Jun 4, 2025
0291ea1
Revert "bug #60564 [FrameworkBundle] ensureKernelShutdown in tearDown…
nicolas-grekas Jun 4, 2025
c193b98
[FrameworkBundle] ensureKernelShutdown in tearDownAfterClass
cquintana92 May 27, 2025
de57965
bug #60693 [FrameworkBundle] ensureKernelShutdown in tearDownAfterCla…
nicolas-grekas Jun 4, 2025
6156095
cs tweak
nicolas-grekas Jun 5, 2025
2547946
[WebProfilerBundle] Fix typos in routing config deprecation messages
dheineman Jun 5, 2025
a784ff8
minor #60703 [WebProfilerBundle] Fix typos in routing config deprecat…
OskarStark Jun 5, 2025
dc09be9
Fix leftover
nicolas-grekas Jun 5, 2025
542cc71
[Security] conflict with event-subscriber v8
nicolas-grekas Jun 5, 2025
851c22c
[HttpClient] Suggest amphp/http-client v5 by default
nicolas-grekas Jun 5, 2025
959b0ff
Merge branch '6.4' into 7.2
nicolas-grekas Jun 5, 2025
02d4200
Merge branch '7.2' into 7.3
nicolas-grekas Jun 5, 2025
9ec87bf
minor #60713 [HttpClient] Suggest amphp/http-client v5 by default (ni…
nicolas-grekas Jun 5, 2025
3733986
Merge branch '7.3' into 7.4
nicolas-grekas Jun 5, 2025
c35e218
minor #60714 [Security] conflict with event-subscriber v8 (nicolas-gr…
nicolas-grekas Jun 5, 2025
3783b01
Merge branch '7.4' into 8.0
nicolas-grekas Jun 5, 2025
2cc9de0
[HttpClient] Remove support for amphp/http-client < 5
nicolas-grekas Jun 5, 2025
3a90806
[HttpClient] Rename amphp "V5" classes
nicolas-grekas Jun 5, 2025
685f224
[HttpClient] Remove setLogger() methods on decorators
nicolas-grekas Jun 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/patch-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php'):
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/'):
case false !== strpos($file, '/src/Symfony/Component/ErrorHandler/Tests/Fixtures/'):
case false !== strpos($file, '/src/Symfony/Component/HttpClient/Internal/') && str_contains($file, 'V4'):
case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/'):
case false !== strpos($file, '/src/Symfony/Component/Runtime/Internal/ComposerPlugin.php'):
case false !== strpos($file, '/src/Symfony/Component/Security/Http/Tests/Fixtures/IsGrantedAttributeMethodsWithClosureController.php'):
Expand Down
6 changes: 6 additions & 0 deletions UPGRADE-8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ release process, both versions have the same features, but Symfony 8.0 doesn't i
To upgrade, make sure to resolve all deprecation notices.
Read more about this in the [Symfony documentation](https://symfony.com/doc/8.0/setup/upgrade_major.html).

HttpClient
----------

* Remove support for amphp/http-client < 5
* Remove setLogger() methods on decorators; configure the logger on the wrapped client directly instead

TwigBridge
----------

Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@
"symfony/yaml": "self.version"
},
"require-dev": {
"amphp/http-client": "^4.2.1|^5.0",
"amphp/http-tunnel": "^1.0|^2.0",
"amphp/http-client": "^5.0",
"amphp/http-tunnel": "^2.0",
"async-aws/ses": "^1.0",
"async-aws/sqs": "^1.0|^2.0",
"async-aws/sns": "^1.0",
Expand Down Expand Up @@ -153,7 +153,6 @@
"psr/http-client": "^1.0",
"psr/simple-cache": "^1.0|^2.0|^3.0",
"seld/jsonlint": "^1.10",
"symfony/amphp-http-client-meta": "^1.0|^2.0",
"symfony/mercure-bundle": "^0.3",
"symfony/phpunit-bridge": "^7.4|^8.0",
"symfony/runtime": "self.version",
Expand All @@ -166,7 +165,7 @@
},
"conflict": {
"ext-psr": "<1.1|>=2",
"amphp/amp": "<2.5",
"amphp/amp": "<3",
"async-aws/core": "<1.5",
"doctrine/collections": "<1.8",
"doctrine/dbal": "<3.6",
Expand Down
14 changes: 9 additions & 5 deletions src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Bundle\FrameworkBundle\Test;

use PHPUnit\Framework\Attributes\AfterClass;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
Expand Down Expand Up @@ -40,6 +39,14 @@ protected function tearDown(): void
static::$booted = false;
}

public static function tearDownAfterClass(): void
{
static::ensureKernelShutdown();
static::$class = null;
static::$kernel = null;
static::$booted = false;
}

/**
* @throws \RuntimeException
* @throws \LogicException
Expand Down Expand Up @@ -113,11 +120,8 @@ protected static function createKernel(array $options = []): KernelInterface

/**
* Shuts the kernel down if it was used in the test - called by the tearDown method by default.
*
* @afterClass
*/
#[AfterClass]
public static function ensureKernelShutdown()
protected static function ensureKernelShutdown()
{
if (null !== static::$kernel) {
static::$kernel->boot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT) as $trace) {
if (isset($trace['object']) && $trace['object'] instanceof XmlFileLoader && 'doImport' === $trace['function']) {
if (__DIR__ === dirname(realpath($trace['args'][3]))) {
trigger_deprecation('symfony/routing', '7.3', 'The "profiler.xml" routing configuration file is deprecated, import "profile.php" instead.');
trigger_deprecation('symfony/routing', '7.3', 'The "profiler.xml" routing configuration file is deprecated, import "profiler.php" instead.');

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT) as $trace) {
if (isset($trace['object']) && $trace['object'] instanceof XmlFileLoader && 'doImport' === $trace['function']) {
if (__DIR__ === dirname(realpath($trace['args'][3]))) {
trigger_deprecation('symfony/routing', '7.3', 'The "xdt.xml" routing configuration file is deprecated, import "xdt.php" instead.');
trigger_deprecation('symfony/routing', '7.3', 'The "wdt.xml" routing configuration file is deprecated, import "wdt.php" instead.');

break;
}
Expand Down
48 changes: 12 additions & 36 deletions src/Symfony/Component/HttpClient/AmpHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,24 @@
namespace Symfony\Component\HttpClient;

use Amp\CancelledException;
use Amp\DeferredFuture;
use Amp\Http\Client\DelegateHttpClient;
use Amp\Http\Client\InterceptedHttpClient;
use Amp\Http\Client\PooledHttpClient;
use Amp\Http\Client\Request;
use Amp\Http\HttpMessage;
use Amp\Http\Tunnel\Http1TunnelConnector;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Component\HttpClient\Internal\AmpClientStateV4;
use Symfony\Component\HttpClient\Internal\AmpClientStateV5;
use Symfony\Component\HttpClient\Response\AmpResponseV4;
use Symfony\Component\HttpClient\Response\AmpResponseV5;
use Symfony\Component\HttpClient\Internal\AmpClientState;
use Symfony\Component\HttpClient\Response\AmpResponse;
use Symfony\Component\HttpClient\Response\ResponseStream;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
use Symfony\Contracts\HttpClient\ResponseStreamInterface;
use Symfony\Contracts\Service\ResetInterface;

if (!interface_exists(DelegateHttpClient::class)) {
throw new \LogicException('You cannot use "Symfony\Component\HttpClient\AmpHttpClient" as the "amphp/http-client" package is not installed. Try running "composer require amphp/http-client:^4.2.1".');
throw new \LogicException('You cannot use "Symfony\Component\HttpClient\AmpHttpClient" as the "amphp/http-client" package is not installed. Try running "composer require amphp/http-client:^5".');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fixed on 7.4 as dc09be9

}

/**
Expand All @@ -52,7 +48,7 @@ final class AmpHttpClient implements HttpClientInterface, LoggerAwareInterface,

private array $defaultOptions = self::OPTIONS_DEFAULTS;
private static array $emptyDefaults = self::OPTIONS_DEFAULTS;
private AmpClientStateV4|AmpClientStateV5 $multi;
private AmpClientState $multi;

/**
* @param array $defaultOptions Default requests' options
Expand All @@ -71,14 +67,7 @@ public function __construct(array $defaultOptions = [], ?callable $clientConfigu
[, $this->defaultOptions] = self::prepareRequest(null, null, $defaultOptions, $this->defaultOptions);
}

if (is_subclass_of(Request::class, HttpMessage::class)) {
$this->multi = new AmpClientStateV5($clientConfigurator, $maxHostConnections, $maxPendingPushes, $this->logger);
} else {
if (\PHP_VERSION_ID >= 80400) {
trigger_deprecation('symfony/http-client', '7.4', 'Using amphp/http-client < 5 is deprecated. Try running "composer require amphp/http-client:^5".');
}
$this->multi = new AmpClientStateV4($clientConfigurator, $maxHostConnections, $maxPendingPushes, $this->logger);
}
$this->multi = new AmpClientState($clientConfigurator, $maxHostConnections, $maxPendingPushes, $this->logger);
}

/**
Expand Down Expand Up @@ -139,10 +128,9 @@ public function request(string $method, string $url, array $options = []): Respo
$request->addHeader($h[0], $h[1]);
}

$coef = $request instanceof HttpMessage ? 1 : 1000;
$request->setTcpConnectTimeout($coef * $options['timeout']);
$request->setTlsHandshakeTimeout($coef * $options['timeout']);
$request->setTransferTimeout($coef * $options['max_duration']);
$request->setTcpConnectTimeout($options['timeout']);
$request->setTlsHandshakeTimeout($options['timeout']);
$request->setTransferTimeout($options['max_duration']);
if (method_exists($request, 'setInactivityTimeout')) {
$request->setInactivityTimeout(0);
}
Expand All @@ -153,24 +141,16 @@ public function request(string $method, string $url, array $options = []): Respo
$request->setHeader('Authorization', 'Basic '.base64_encode(implode(':', $auth)));
}

if ($request instanceof HttpMessage) {
return new AmpResponseV5($this->multi, $request, $options, $this->logger);
}

return new AmpResponseV4($this->multi, $request, $options, $this->logger);
return new AmpResponse($this->multi, $request, $options, $this->logger);
}

public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
{
if ($responses instanceof AmpResponseV4 || $responses instanceof AmpResponseV5) {
if ($responses instanceof AmpResponse) {
$responses = [$responses];
}

if ($this->multi instanceof AmpClientStateV5) {
return new ResponseStream(AmpResponseV5::stream($responses, $timeout));
}

return new ResponseStream(AmpResponseV4::stream($responses, $timeout));
return new ResponseStream(AmpResponse::stream($responses, $timeout));
}

public function reset(): void
Expand All @@ -179,11 +159,7 @@ public function reset(): void

foreach ($this->multi->pushedResponses as $pushedResponses) {
foreach ($pushedResponses as [$pushedUrl, $pushDeferred]) {
if ($pushDeferred instanceof DeferredFuture) {
$pushDeferred->error(new CancelledException());
} else {
$pushDeferred->fail(new CancelledException());
}
$pushDeferred->fail(new CancelledException());

$this->logger?->debug(\sprintf('Unused pushed response: "%s"', $pushedUrl));
}
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/HttpClient/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========

8.0
---

* Remove support for amphp/http-client < 5
* Remove setLogger() methods on decorators; configure the logger on the wrapped client directly instead

7.4
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @internal
*/
class AmpBodyV5 implements HttpContent, ReadableStream, \IteratorAggregate
class AmpBody implements HttpContent, ReadableStream, \IteratorAggregate
{
private ReadableStream $body;
private ?string $content;
Expand Down
148 changes: 0 additions & 148 deletions src/Symfony/Component/HttpClient/Internal/AmpBodyV4.php

This file was deleted.

Loading
Loading