Merge branch '2.3' into 2.7

* 2.3:
  fixed issue with PHP 5.3
  The WebProcessor now forwards the client IP
  bumped Symfony version to 2.3.39
  updated VERSION for 2.3.38
  update CONTRIBUTORS for 2.3.38
  updated CHANGELOG for 2.3.38
This commit is contained in:
Fabien Potencier 2016-03-01 12:09:07 +01:00
commit 41112c9ee9
4 changed files with 276 additions and 164 deletions

View File

@ -7,6 +7,52 @@ in 2.3 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1
* 2.3.38 (2016-02-28)
* bug #17947 Fix - #17676 (backport #17919 to 2.3) (Ocramius)
* bug #17942 Fix bug when using an private aliased factory service (WouterJ)
* bug #17542 ChoiceFormField of type "select" could be "disabled" (bouland)
* bug #17602 [HttpFoundation] Fix BinaryFileResponse incorrect behavior with if-range header (bburnichon)
* bug #17914 [Console] Fix escaping of trailing backslashes (nicolas-grekas)
* bug #17074 Fix constraint validator alias being required (Triiistan)
* bug #17867 [DependencyInjection] replace alias in factory services (xabbuh)
* bug #17569 [FrameworkBundle] read commands from bundles when accessing list (havvg)
* bug #16987 [FileSystem] Windows fix (flip111)
* bug #17835 [Yaml] fix default timezone to be UTC (xabbuh)
* bug #17823 [DependencyInjection] fix dumped YAML string (xabbuh)
* bug #17814 [DependencyInjection] fix dumped YAML snytax (xabbuh)
* bug #17099 [Form] Fixed violation mapping if multiple forms are using the same (or part of the same) property path (alekitto)
* bug #17719 [DependencyInjection] fixed exceptions thrown by get method of ContainerBuilder (lukaszmakuch)
* bug #17742 [DependencyInjection] Fix #16461 Container::set() replace aliases (mnapoli)
* bug #17745 Added more exceptions to singularify method (javiereguiluz)
* bug #17766 Fixed (string) catchable fatal error for PHP Incomplete Class instances (yceruto)
* bug #17757 [HttpFoundation] BinaryFileResponse sendContent return as parent. (2.3) (SpacePossum)
* bug #17702 [TwigBridge] forward compatibility with Yaml 3.1 (xabbuh)
* bug #17672 [DependencyInjection][Routing] add files used in FileResource objects (xabbuh)
* bug #17596 [Translation] Add resources from fallback locale to parent catalogue (c960657)
* bug #16956 [DependencyInjection] XmlFileLoader: enforce tags to have a name (xabbuh)
* bug #16265 [BrowserKit] Corrected HTTP_HOST logic (Naktibalda)
* bug #17555 [DependencyInjection] resolve aliases in factory services (xabbuh)
* bug #15272 [FrameworkBundle] Fix template location for PHP templates (jakzal)
* bug #11232 [Routing] Fixes fatal errors with object resources in AnnotationDirectoryLoader::supports (Tischoi)
* bug #17526 Escape the delimiter in Glob::toRegex (javiereguiluz)
* bug #17527 fixed undefined variable (fabpot)
* bug #15706 [framework-bundle] Added support for the `0.0.0.0/0` trusted proxy (zerkms)
* bug #16274 [HttpKernel] Lookup the response even if the lock was released after two second wait (jakzal)
* bug #17355 [DoctrineBridge][Validator] >= 2.3 Pass association instead of ID as argument (xavismeh)
* bug #16736 [Request] Ignore invalid IP addresses sent by proxies (GromNaN)
* bug #16873 Able to load big xml files with DomCrawler (zorn-v)
* bug #16897 [Form] Fix constraints could be null if not set (DZunke)
* bug #17505 sort bundles in config:dump-reference command (xabbuh)
* bug #17478 [HttpFoundation] Do not overwrite the Authorization header if it is already set (jakzal)
* bug #17461 [Yaml] tag for dumped PHP objects must be a local one (xabbuh)
* bug #17423 [Process] Use stream based storage to avoid memory issues (romainneutron)
* bug #17373 [SecurityBundle] fix SecureRandom service constructor args (Tobion)
* bug #17377 Fix performance (PHP5) and memory (PHP7) issues when using token_get_all (nicolas-grekas, peteward)
* bug #17389 [Routing] Fixed correct class name in thrown exception (fixes #17388) (robinvdvleuten)
* bug #17358 [ClassLoader] Use symfony/polyfill-apcu (nicolas-grekas)
* bug #17370 [HttpFoundation][Cookie] Cookie DateTimeInterface fix (wildewouter)
* 2.3.37 (2016-01-14)
* security #17359 do not ship with a custom rng implementation (xabbuh, fabpot)

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@ class WebProcessor extends BaseWebProcessor
{
if ($event->isMasterRequest()) {
$this->serverData = $event->getRequest()->server->all();
$this->serverData['REMOTE_ADDR'] = $event->getRequest()->getClientIp();
}
}
}

View File

@ -33,6 +33,23 @@ class WebProcessorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']);
}
public function testUseRequestClientIp()
{
Request::setTrustedProxies(array('192.168.0.1'));
list($event, $server) = $this->createRequestEvent(array('X_FORWARDED_FOR' => '192.168.0.2'));
$processor = new WebProcessor();
$processor->onKernelRequest($event);
$record = $processor($this->getRecord());
$this->assertCount(5, $record['extra']);
$this->assertEquals($server['REQUEST_URI'], $record['extra']['url']);
$this->assertEquals($server['X_FORWARDED_FOR'], $record['extra']['ip']);
$this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']);
$this->assertEquals($server['SERVER_NAME'], $record['extra']['server']);
$this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']);
}
public function testCanBeConstructedWithExtraFields()
{
if (!$this->isExtraFieldsSupported()) {
@ -53,18 +70,22 @@ class WebProcessorTest extends \PHPUnit_Framework_TestCase
/**
* @return array
*/
private function createRequestEvent()
private function createRequestEvent($additionalServerParameters = array())
{
$server = array(
'REQUEST_URI' => 'A',
'REMOTE_ADDR' => 'B',
'REQUEST_METHOD' => 'C',
'SERVER_NAME' => 'D',
'HTTP_REFERER' => 'E',
$server = array_merge(
array(
'REQUEST_URI' => 'A',
'REMOTE_ADDR' => '192.168.0.1',
'REQUEST_METHOD' => 'C',
'SERVER_NAME' => 'D',
'HTTP_REFERER' => 'E',
),
$additionalServerParameters
);
$request = new Request();
$request->server->replace($server);
$request->headers->replace($server);
$event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')
->disableOriginalConstructor()