From 366604d5e02f47d6218a5c693b1fe542c96fd371 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 14 Apr 2024 13:10:41 +0200 Subject: [PATCH 1/4] implement NodeVisitorInterface instead of extending AbstractNodeVisitor --- .../TranslationDefaultDomainNodeVisitor.php | 14 ++++---------- .../Twig/NodeVisitor/TranslationNodeVisitor.php | 14 ++++---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php index 213365ed9f1ef..7570126fa80eb 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php @@ -23,12 +23,12 @@ use Twig\Node\ModuleNode; use Twig\Node\Node; use Twig\Node\SetNode; -use Twig\NodeVisitor\AbstractNodeVisitor; +use Twig\NodeVisitor\NodeVisitorInterface; /** * @author Fabien Potencier */ -final class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor +final class TranslationDefaultDomainNodeVisitor implements NodeVisitorInterface { private $scope; @@ -37,10 +37,7 @@ public function __construct() $this->scope = new Scope(); } - /** - * {@inheritdoc} - */ - protected function doEnterNode(Node $node, Environment $env): Node + public function enterNode(Node $node, Environment $env): Node { if ($node instanceof BlockNode || $node instanceof ModuleNode) { $this->scope = $this->scope->enter(); @@ -86,10 +83,7 @@ protected function doEnterNode(Node $node, Environment $env): Node return $node; } - /** - * {@inheritdoc} - */ - protected function doLeaveNode(Node $node, Environment $env): ?Node + public function leaveNode(Node $node, Environment $env): ?Node { if ($node instanceof TransDefaultDomainNode) { return null; diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php index ac0ccd21cdd37..39cd4b142af10 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php @@ -18,14 +18,14 @@ use Twig\Node\Expression\FilterExpression; use Twig\Node\Expression\FunctionExpression; use Twig\Node\Node; -use Twig\NodeVisitor\AbstractNodeVisitor; +use Twig\NodeVisitor\NodeVisitorInterface; /** * TranslationNodeVisitor extracts translation messages. * * @author Fabien Potencier */ -final class TranslationNodeVisitor extends AbstractNodeVisitor +final class TranslationNodeVisitor implements NodeVisitorInterface { public const UNDEFINED_DOMAIN = '_undefined'; @@ -49,10 +49,7 @@ public function getMessages(): array return $this->messages; } - /** - * {@inheritdoc} - */ - protected function doEnterNode(Node $node, Environment $env): Node + public function enterNode(Node $node, Environment $env): Node { if (!$this->enabled) { return $node; @@ -101,10 +98,7 @@ protected function doEnterNode(Node $node, Environment $env): Node return $node; } - /** - * {@inheritdoc} - */ - protected function doLeaveNode(Node $node, Environment $env): ?Node + public function leaveNode(Node $node, Environment $env): ?Node { return $node; } From 50acbe69d02e1c626a3048f2b603e7a403426378 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 16 Apr 2024 10:45:54 +0200 Subject: [PATCH 2/4] Adjust pretty name of closures on PHP 8.4 --- .../FrameworkBundle/Console/Descriptor/JsonDescriptor.php | 2 +- .../FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php | 2 +- .../FrameworkBundle/Console/Descriptor/TextDescriptor.php | 2 +- .../Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php | 2 +- .../Bundle/SecurityBundle/Command/DebugFirewallCommand.php | 2 +- src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php | 2 +- src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php | 2 +- .../HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php | 2 +- .../Component/HttpKernel/DataCollector/RequestDataCollector.php | 2 +- .../HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php | 2 +- src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php | 2 +- src/Symfony/Component/String/LazyString.php | 2 +- src/Symfony/Component/String/Tests/LazyStringTest.php | 2 +- src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index 585af1eefd539..e25ee21d72a8f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -356,7 +356,7 @@ private function getCallableData($callable): array $data['type'] = 'closure'; $r = new \ReflectionFunction($callable); - if (str_contains($r->name, '{closure}')) { + if (str_contains($r->name, '{closure')) { return $data; } $data['name'] = $r->name; diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index f23be9d579952..12ab4d4f73435 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -372,7 +372,7 @@ protected function describeCallable($callable, array $options = []) $string .= "\n- Type: `closure`"; $r = new \ReflectionFunction($callable); - if (str_contains($r->name, '{closure}')) { + if (str_contains($r->name, '{closure')) { return $this->write($string."\n"); } $string .= "\n".sprintf('- Name: `%s`', $r->name); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 39dc8fb210ab7..f2e7cee78c486 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -611,7 +611,7 @@ private function formatCallable($callable): string if ($callable instanceof \Closure) { $r = new \ReflectionFunction($callable); - if (str_contains($r->name, '{closure}')) { + if (str_contains($r->name, '{closure')) { return 'Closure()'; } if ($class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php index 56b1af9bf6c64..8daf880f3043c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php @@ -543,7 +543,7 @@ private function getCallableDocument($callable): \DOMDocument $callableXML->setAttribute('type', 'closure'); $r = new \ReflectionFunction($callable); - if (str_contains($r->name, '{closure}')) { + if (str_contains($r->name, '{closure')) { return $dom; } $callableXML->setAttribute('name', $r->name); diff --git a/src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php index 3757c5657ae4a..6fc6a0ed95f88 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/DebugFirewallCommand.php @@ -252,7 +252,7 @@ private function formatCallable($callable): string if ($callable instanceof \Closure) { $r = new \ReflectionFunction($callable); - if (false !== strpos($r->name, '{closure}')) { + if (str_contains($r->name, '{closure')) { return 'Closure()'; } if ($class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) { diff --git a/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php b/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php index 75a91d9e221cc..2b625f6388af3 100644 --- a/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/ErrorHandler/Tests/ErrorHandlerTest.php @@ -171,7 +171,7 @@ public function testCallErrorExceptionInfo() } $this->assertSame(__FILE__, $e->getFile()); $this->assertSame(0, $e->getCode()); - $this->assertSame('Symfony\Component\ErrorHandler\{closure}', $trace[0]['function']); + $this->assertStringMatchesFormat('%A{closure%A}', $trace[0]['function']); $this->assertSame(ErrorHandler::class, $trace[0]['class']); $this->assertSame('triggerNotice', $trace[1]['function']); $this->assertSame(__CLASS__, $trace[1]['class']); diff --git a/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php b/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php index 80d49a168b701..792c175613501 100644 --- a/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php +++ b/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php @@ -47,7 +47,7 @@ public function __construct($listener, ?string $name, Stopwatch $stopwatch, ?Eve $this->pretty = $this->name.'::'.$listener[1]; } elseif ($listener instanceof \Closure) { $r = new \ReflectionFunction($listener); - if (str_contains($r->name, '{closure}')) { + if (str_contains($r->name, '{closure')) { $this->pretty = $this->name = 'closure'; } elseif ($class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) { $this->name = $class->name; diff --git a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php index 85bb805f34bb6..00e673349e67c 100644 --- a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php +++ b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php @@ -33,7 +33,7 @@ public function createArgumentMetadata($controller): array $class = $reflection->class; } else { $reflection = new \ReflectionFunction($controller); - if ($class = str_contains($reflection->name, '{closure}') ? null : (\PHP_VERSION_ID >= 80111 ? $reflection->getClosureCalledClass() : $reflection->getClosureScopeClass())) { + if ($class = str_contains($reflection->name, '{closure') ? null : (\PHP_VERSION_ID >= 80111 ? $reflection->getClosureCalledClass() : $reflection->getClosureScopeClass())) { $class = $class->name; } } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index c56013c2eaad8..6931336f06d17 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -474,7 +474,7 @@ private function parseController($controller) 'line' => $r->getStartLine(), ]; - if (str_contains($r->name, '{closure}')) { + if (str_contains($r->name, '{closure')) { return $controller; } $controller['method'] = $r->name; diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php index becb9b01bfd0a..e08758cf730e0 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php @@ -118,7 +118,7 @@ public static function provideControllerCallables(): array 'Closure', function () { return 'foo'; }, [ - 'class' => __NAMESPACE__.'\{closure}', + 'class' => \PHP_VERSION_ID >= 80400 ? sprintf('{closure:%s():%d}', __METHOD__, __LINE__ - 2) : __NAMESPACE__.'\{closure}', 'method' => null, 'file' => __FILE__, 'line' => __LINE__ - 5, diff --git a/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php b/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php index 5957e3f13823b..20d2c2043a7e7 100644 --- a/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php +++ b/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php @@ -34,7 +34,7 @@ public function __construct(callable $handler, array $options = []) $r = new \ReflectionFunction($handler); - if (str_contains($r->name, '{closure}')) { + if (str_contains($r->name, '{closure')) { $this->name = 'Closure'; } elseif (!$handler = $r->getClosureThis()) { $class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass(); diff --git a/src/Symfony/Component/String/LazyString.php b/src/Symfony/Component/String/LazyString.php index 9c7a9c58b659b..5f7e7370d78d8 100644 --- a/src/Symfony/Component/String/LazyString.php +++ b/src/Symfony/Component/String/LazyString.php @@ -148,7 +148,7 @@ private static function getPrettyName(callable $callback): string } elseif ($callback instanceof \Closure) { $r = new \ReflectionFunction($callback); - if (false !== strpos($r->name, '{closure}') || !$class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) { + if (str_contains($r->name, '{closure') || !$class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) { return $r->name; } diff --git a/src/Symfony/Component/String/Tests/LazyStringTest.php b/src/Symfony/Component/String/Tests/LazyStringTest.php index c311a3be9ff06..02601b6faaf16 100644 --- a/src/Symfony/Component/String/Tests/LazyStringTest.php +++ b/src/Symfony/Component/String/Tests/LazyStringTest.php @@ -65,7 +65,7 @@ public function testReturnTypeError() $s = LazyString::fromCallable(function () { return []; }); $this->expectException(\TypeError::class); - $this->expectExceptionMessage('Return value of '.__NAMESPACE__.'\{closure}() passed to '.LazyString::class.'::fromCallable() must be of the type string, array returned.'); + $this->expectExceptionMessageMatches('{^Return value of .*\{closure.*\}\(\) passed to '.preg_quote(LazyString::class).'::fromCallable\(\) must be of the type string, array returned\.$}'); (string) $s; } diff --git a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php index 6f1b8f2f25a5e..35fd1e8a99b2b 100644 --- a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php @@ -42,7 +42,7 @@ public static function castClosure(\Closure $c, array $a, Stub $stub, bool $isNe $a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter); - if (!str_contains($c->name, '{closure}')) { + if (!str_contains($c->name, '{closure')) { $stub->class = isset($a[$prefix.'class']) ? $a[$prefix.'class']->value.'::'.$c->name : $c->name; unset($a[$prefix.'class']); } From 9189c8cd94add9d25e44d21f61dc5c27d1552ede Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 16 Apr 2024 16:33:04 +0200 Subject: [PATCH 3/4] Bump ext-redis in CI on PHP >= 8.4 --- .github/workflows/unit-tests.yml | 3 ++- .../Redis/Tests/Transport/ConnectionTest.php | 14 +++++++------- .../Bridge/Redis/Transport/Connection.php | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 159abdf72ac02..969835cccdde1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -34,6 +34,7 @@ jobs: mode: low-deps - php: '8.3' - php: '8.4' + extensions: amqp,apcu,igbinary,intl,mbstring,memcached,redis #mode: experimental fail-fast: false @@ -51,7 +52,7 @@ jobs: coverage: "none" ini-values: date.timezone=UTC,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1 php-version: "${{ matrix.php }}" - extensions: "${{ env.extensions }}" + extensions: "${{ matrix.extensions || env.extensions }}" tools: flex - name: Configure environment diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php index 71ccea4c1752e..2e5c7bf0b043e 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php @@ -154,7 +154,7 @@ public function testKeepGettingPendingMessages() $redis = $this->createMock(\Redis::class); $redis->expects($this->exactly(3))->method('xreadgroup') - ->with('symfony', 'consumer', ['queue' => 0], 1, null) + ->with('symfony', 'consumer', ['queue' => 0], 1, 1) ->willReturn(['queue' => [['message' => json_encode(['body' => 'Test', 'headers' => []])]]]); $connection = Connection::fromDsn('redis://localhost/queue', ['delete_after_ack' => true], $redis); @@ -250,7 +250,7 @@ public function testGetPendingMessageFirst() $redis = $this->createMock(\Redis::class); $redis->expects($this->exactly(1))->method('xreadgroup') - ->with('symfony', 'consumer', ['queue' => '0'], 1, null) + ->with('symfony', 'consumer', ['queue' => '0'], 1, 1) ->willReturn(['queue' => [['message' => '{"body":"1","headers":[]}']]]); $connection = Connection::fromDsn('redis://localhost/queue', ['delete_after_ack' => true], $redis); @@ -275,11 +275,11 @@ public function testClaimAbandonedMessageWithRaceCondition() ->willReturnCallback(function (...$args) { static $series = [ // first call for pending messages - [['symfony', 'consumer', ['queue' => '0'], 1, null], []], + [['symfony', 'consumer', ['queue' => '0'], 1, 1], []], // second call because of claimed message (redisid-123) - [['symfony', 'consumer', ['queue' => '0'], 1, null], []], + [['symfony', 'consumer', ['queue' => '0'], 1, 1], []], // third call because of no result (other consumer claimed message redisid-123) - [['symfony', 'consumer', ['queue' => '>'], 1, null], []], + [['symfony', 'consumer', ['queue' => '>'], 1, 1], []], ]; [$expectedArgs, $return] = array_shift($series); @@ -311,9 +311,9 @@ public function testClaimAbandonedMessage() ->willReturnCallback(function (...$args) { static $series = [ // first call for pending messages - [['symfony', 'consumer', ['queue' => '0'], 1, null], []], + [['symfony', 'consumer', ['queue' => '0'], 1, 1], []], // second call because of claimed message (redisid-123) - [['symfony', 'consumer', ['queue' => '0'], 1, null], ['queue' => [['message' => '{"body":"1","headers":[]}']]]], + [['symfony', 'consumer', ['queue' => '0'], 1, 1], ['queue' => [['message' => '{"body":"1","headers":[]}']]]], ]; [$expectedArgs, $return] = array_shift($series); diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php b/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php index 16633a354fcfe..f0c7188b3754e 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php @@ -389,6 +389,7 @@ public function get(): ?array $this->group, $this->consumer, [$this->stream => $messageId], + 1, 1 ); } catch (\RedisException $e) { From 132b4719fe8eaecb09610d574fa7d4cab0c37e8a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 16 Apr 2024 17:42:30 +0200 Subject: [PATCH 4/4] Fix CI --- .../Component/Cache/Tests/Traits/RedisTraitTest.php | 12 +++++++++--- .../Component/Filesystem/Tests/FilesystemTest.php | 4 ++-- .../Component/Mime/Tests/Part/DataPartTest.php | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php b/src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php index 6efaa4487c26a..650a0c71c1c2e 100644 --- a/src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php +++ b/src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php @@ -32,7 +32,9 @@ public function testCreateConnection(string $dsn, string $expectedClass) throw new SkippedTestSuiteError('REDIS_CLUSTER_HOSTS env var is not defined.'); } - $mock = self::getObjectForTrait(RedisTrait::class); + $mock = new class () { + use RedisTrait; + }; $connection = $mock::createConnection($dsn); self::assertInstanceOf($expectedClass, $connection); @@ -44,7 +46,9 @@ public function testUrlDecodeParameters() self::markTestSkipped('REDIS_AUTHENTICATED_HOST env var is not defined.'); } - $mock = self::getObjectForTrait(RedisTrait::class); + $mock = new class () { + use RedisTrait; + }; $connection = $mock::createConnection('redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST')); self::assertInstanceOf(\Redis::class, $connection); @@ -101,7 +105,9 @@ public function testPconnectSelectsCorrectDatabase() } try { - $mock = self::getObjectForTrait(RedisTrait::class); + $mock = new class () { + use RedisTrait; + }; $dsn = 'redis://'.getenv('REDIS_HOST'); diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 47c89995f7895..101f30f898714 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -171,14 +171,14 @@ public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy() } $finder = new PhpExecutableFinder(); - $process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057'])); + $process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', 'localhost:8057'])); $process->setWorkingDirectory(__DIR__.'/Fixtures/web'); $process->start(); do { usleep(50000); - } while (!@fopen('http://127.0.0.1:8057', 'r')); + } while (!@fopen('http://localhost:8057', 'r')); try { $sourceFilePath = 'http://localhost:8057/logo_symfony_header.png'; diff --git a/src/Symfony/Component/Mime/Tests/Part/DataPartTest.php b/src/Symfony/Component/Mime/Tests/Part/DataPartTest.php index 361bb00be5d19..3d306f2e8ff86 100644 --- a/src/Symfony/Component/Mime/Tests/Part/DataPartTest.php +++ b/src/Symfony/Component/Mime/Tests/Part/DataPartTest.php @@ -143,14 +143,14 @@ public function testFromPathWithUrl() } $finder = new PhpExecutableFinder(); - $process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057'])); + $process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', 'localhost:8057'])); $process->setWorkingDirectory(__DIR__.'/../Fixtures/web'); $process->start(); try { do { usleep(50000); - } while (!@fopen('http://127.0.0.1:8057', 'r')); + } while (!@fopen('http://localhost:8057', 'r')); $p = DataPart::fromPath($file = 'http://localhost:8057/logo_symfony_header.png'); $content = file_get_contents($file); $this->assertEquals($content, $p->getBody());