Merge branch '2.8' into 3.4

* 2.8:
  use brace-style regex delimiters
  Fixed typo RecursiveIterator -> RecursiveIteratorIterator
  [Validator] make phpdoc of ObjectInitializerInterface interface more accurate
This commit is contained in:
Fabien Potencier 2018-05-07 09:00:50 +02:00
commit 40bcd7722b
3 changed files with 11 additions and 4 deletions

View File

@ -17,7 +17,7 @@ namespace Symfony\Component\Form\Util;
* Contrary to \ArrayIterator, this iterator recognizes changes in the original
* array during iteration.
*
* You can wrap the iterator into a {@link \RecursiveIterator} in order to
* You can wrap the iterator into a {@link \RecursiveIteratorIterator} in order to
* enter any child form that inherits its parent's data and iterate the children
* of that form as well.
*

View File

@ -641,7 +641,7 @@ class Request
public static function setTrustedHosts(array $hostPatterns)
{
self::$trustedHostPatterns = array_map(function ($hostPattern) {
return sprintf('#%s#i', $hostPattern);
return sprintf('{%s}i', $hostPattern);
}, $hostPatterns);
// we need to reset trusted hosts on trusted host patterns change
self::$trustedHosts = array();

View File

@ -23,6 +23,7 @@ class RequestTest extends TestCase
{
// reset
Request::setTrustedProxies(array(), -1);
Request::setTrustedHosts(array());
}
public function testInitialize()
@ -2007,9 +2008,15 @@ class RequestTest extends TestCase
$request->headers->set('host', 'subdomain.trusted.com');
$this->assertEquals('subdomain.trusted.com', $request->getHost());
}
// reset request for following tests
Request::setTrustedHosts(array());
public function testSetTrustedHostsDoesNotBreakOnSpecialCharacters()
{
Request::setTrustedHosts(array('localhost(\.local){0,1}#,example.com', 'localhost'));
$request = Request::create('/');
$request->headers->set('host', 'localhost');
$this->assertSame('localhost', $request->getHost());
}
public function testFactory()