diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
index 94253c7ee7ca2..4f274e2d12efa 100644
--- a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
+++ b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
@@ -60,11 +60,20 @@ public static function setUpBeforeClass()
public static function tearDownAfterClass()
{
- foreach (array_reverse(self::$files) as $file) {
- if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
- @rmdir($file);
+ $paths = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator(self::$tmpDir, \RecursiveDirectoryIterator::SKIP_DOTS),
+ \RecursiveIteratorIterator::CHILD_FIRST
+ );
+
+ foreach ($paths as $path) {
+ if ($path->isDir()) {
+ if ($path->isLink()) {
+ @unlink($path);
+ } else {
+ @rmdir($path);
+ }
} else {
- @unlink($file);
+ @unlink($path);
}
}
}
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.hy.xlf b/src/Symfony/Component/Form/Resources/translations/validators.hy.xlf
index 5a6091f890545..7550cb1b5818e 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.hy.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.hy.xlf
@@ -1,4 +1,4 @@
-
+
@@ -16,4 +16,4 @@
-
\ No newline at end of file
+
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Form/Resources/translations/validators.lt.xlf
index 25f30887bc1bf..e9eebc7389739 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.lt.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.lt.xlf
@@ -1,4 +1,4 @@
-
+
@@ -16,4 +16,4 @@
-
\ No newline at end of file
+
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.mn.xlf b/src/Symfony/Component/Form/Resources/translations/validators.mn.xlf
index 002b01c175b8f..171df74d63c0c 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.mn.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.mn.xlf
@@ -1,4 +1,4 @@
-
+
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.ru.xlf b/src/Symfony/Component/Form/Resources/translations/validators.ru.xlf
index 8d829f1b46ea4..fbbbeb442297c 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.ru.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.ru.xlf
@@ -1,4 +1,4 @@
-
+
@@ -16,4 +16,4 @@
-
\ No newline at end of file
+
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
index 81c75ff7403a4..6f467876989b8 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
@@ -185,7 +185,11 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
// FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism
if (HttpKernelInterface::MASTER_REQUEST === $type) {
$this->traces = array();
- $this->request = $request;
+ // Keep a clone of the original request for surrogates so they can access it.
+ // We must clone here to get a separate instance because the application will modify the request during
+ // the application flow (we know it always does because we do ourselves by setting REMOTE_ADDR to 127.0.0.1
+ // and adding the X-Forwarded-For header, see HttpCache::forward()).
+ $this->request = clone $request;
if (null !== $this->surrogate) {
$this->surrogateCacheStrategy = $this->surrogate->createCacheStrategy();
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
index 41c2d57833769..ab584a9871c2c 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
@@ -11,9 +11,12 @@
namespace Symfony\Component\HttpKernel\Tests\HttpCache;
+use Symfony\Component\HttpKernel\HttpCache\Esi;
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpKernel\HttpCache\Store;
+use Symfony\Component\HttpKernel\HttpCache\StoreInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
/**
@@ -1432,6 +1435,42 @@ public function testDoesNotCacheOptionsRequest()
$this->assertHttpKernelIsNotCalled();
$this->assertSame('get', $this->response->getContent());
}
+
+ public function testUsesOriginalRequestForSurrogate()
+ {
+ $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
+ $store = $this->getMockBuilder(StoreInterface::class)->getMock();
+
+ $kernel
+ ->expects($this->exactly(2))
+ ->method('handle')
+ ->willReturnCallback(function (Request $request) {
+ $this->assertSame('127.0.0.1', $request->server->get('REMOTE_ADDR'));
+
+ return new Response();
+ });
+
+ $cache = new HttpCache($kernel,
+ $store,
+ new Esi()
+ );
+
+ $request = Request::create('/');
+ $request->server->set('REMOTE_ADDR', '10.0.0.1');
+
+ // Main request
+ $cache->handle($request, HttpKernelInterface::MASTER_REQUEST);
+
+ // Main request was now modified by HttpCache
+ // The surrogate will ask for the request using $this->cache->getRequest()
+ // which MUST return the original request so the surrogate
+ // can actually behave like a reverse proxy like e.g. Varnish would.
+ $this->assertSame('10.0.0.1', $cache->getRequest()->getClientIp());
+ $this->assertSame('10.0.0.1', $cache->getRequest()->server->get('REMOTE_ADDR'));
+
+ // Surrogate request
+ $cache->handle($request, HttpKernelInterface::SUB_REQUEST);
+ }
}
class TestKernel implements HttpKernelInterface
diff --git a/src/Symfony/Component/Routing/composer.json b/src/Symfony/Component/Routing/composer.json
index 7fb49738ef01e..96384910dc8e2 100644
--- a/src/Symfony/Component/Routing/composer.json
+++ b/src/Symfony/Component/Routing/composer.json
@@ -24,7 +24,6 @@
"symfony/yaml": "^2.0.5|~3.0.0",
"symfony/expression-language": "~2.4|~3.0.0",
"doctrine/annotations": "~1.0",
- "doctrine/common": "~2.2",
"psr/log": "~1.0"
},
"conflict": {
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf
index a556c45f0c42f..6bdb8142a33e2 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf
@@ -1,4 +1,4 @@
-
+
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf
index dfe7eebf6d53e..4be2198aa3b27 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.mn.xlf
@@ -1,4 +1,4 @@
-
+
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf
index d7a90c907ed08..3ce5e6e9d4330 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf
@@ -1,4 +1,4 @@
-
+
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf
index 02ecd5a687c93..3b1f28631b411 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.uk.xlf
@@ -1,4 +1,4 @@
-
+