Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8efff1b

Browse files
committed
Merge branch '2.3' into 2.4
* 2.3: [2.3] Add missing development dependencies Fix @return docs on HttpCache::restoreResponseBody() [Finder] Escape location for regex searches Make sure HttpCache is a trusted proxy Conflicts: src/Symfony/Bridge/Doctrine/composer.json src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Bundle/SecurityBundle/composer.json src/Symfony/Component/Form/composer.json
2 parents 27e8c65 + 4ac8add commit 8efff1b

File tree

15 files changed

+72
-12
lines changed

15 files changed

+72
-12
lines changed

.travis.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ php:
1111
matrix:
1212
allow_failures:
1313
- php: hhvm-nightly
14+
include:
15+
- php: 5.5
16+
env: components=yes
1417

1518
services: mongodb
1619

20+
env:
21+
global:
22+
- components=no
23+
1724
before_install:
1825
- travis_retry sudo apt-get install parallel
1926
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi;'
@@ -25,8 +32,9 @@ before_install:
2532
# - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "5.3.3" ]; then phpunit --self-update; fi;'
2633

2734
install:
28-
- COMPOSER_ROOT_VERSION=dev-master composer --prefer-source install
35+
- sh -c 'if [ "$components" = "no" ]; then sh -c "COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install"; fi;'
2936

3037
script:
31-
- ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo "Running {} tests"; phpunit --exclude-group tty,benchmark {};'
32-
- echo "Running tests requiring tty"; phpunit --group tty
38+
- sh -c 'if [ "$components" = "no" ]; then sh -c "ls -d src/Symfony/*/* | parallel --gnu --keep-order '\''echo \"Running {} tests\"; phpunit --exclude-group tty,benchmark {};'\''"; fi;'
39+
- sh -c 'if [ "$components" = "no" ]; then sh -c "echo "\""Running tests requiring tty"\""; phpunit --group tty"; fi;'
40+
- sh -c 'if [ "$components" = "yes" ]; then sh -c "find src/Symfony -mindepth 3 -type f -name '\''phpunit.xml.dist'\'' | sed '\''s#\(.*\)/.*#\1#'\'' | parallel --gnu --keep-order '\''echo \"Running {} tests\"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install; phpunit --exclude-group tty,benchmark;'\''"; fi;'

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"symfony/http-kernel": "~2.2",
2727
"symfony/security": "~2.2",
2828
"symfony/expression-language": "~2.2",
29-
"symfony/validator": "~2.2",
29+
"symfony/validator": "~2.3.0",
3030
"doctrine/data-fixtures": "1.0.*",
3131
"doctrine/dbal": "~2.2",
3232
"doctrine/orm": "~2.2,>=2.2.3"

src/Symfony/Bridge/ProxyManager/composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
"symfony/dependency-injection": "~2.3",
2121
"ocramius/proxy-manager": ">=0.3.1,<0.6-dev"
2222
},
23+
"require-dev": {
24+
"symfony/config": "2.3"
25+
},
2326
"autoload": {
2427
"psr-0": {
2528
"Symfony\\Bridge\\ProxyManager\\": ""

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@
3232
"doctrine/annotations": "~1.0"
3333
},
3434
"require-dev": {
35+
"symfony/browser-kit": "~2.3",
36+
"symfony/console": "~2.0",
3537
"symfony/finder": "~2.0",
3638
"symfony/security": "~2.4",
37-
"symfony/form": "~2.3",
39+
"symfony/form": "~2.4",
3840
"symfony/class-loader": "~2.1",
39-
"symfony/validator": "~2.1"
41+
"symfony/process": "~2.0",
42+
"symfony/validator": "~2.1",
43+
"symfony/yaml": "~2.0"
4044
},
4145
"suggest": {
4246
"symfony/console": "For using the console commands",

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
"symfony/http-kernel": "~2.2"
2222
},
2323
"require-dev": {
24+
"symfony/browser-kit": "~2.3",
25+
"symfony/form": "~2.3",
2426
"symfony/framework-bundle": "~2.2",
2527
"symfony/twig-bundle": "~2.2",
28+
"symfony/process": "~2.0",
2629
"symfony/validator": "~2.2",
2730
"symfony/yaml": "~2.0",
2831
"symfony/expression-language": "~2.4"

src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111

1212
namespace Symfony\Bundle\WebProfilerBundle\Tests\Controller;
1313

14-
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1514
use Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController;
1615
use Symfony\Component\HttpKernel\Profiler\Profile;
1716
use Symfony\Component\HttpFoundation\Request;
1817

19-
class ProfilerControllerTest extends TestCase
18+
class ProfilerControllerTest extends \PHPUnit_Framework_TestCase
2019
{
2120
/**
2221
* @dataProvider getEmptyTokenCases

src/Symfony/Bundle/WebProfilerBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
},
2424
"require-dev": {
2525
"symfony/config": "~2.2",
26+
"symfony/console": "~2.3",
2627
"symfony/dependency-injection": "~2.0",
2728
"symfony/stopwatch": "~2.2"
2829
},

src/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private function buildPathsFiltering(Command $command, $dir, array $paths, $not
216216
// Fixes 'not search' regex problems.
217217
if ($expr->isRegex()) {
218218
$regex = $expr->getRegex();
219-
$regex->prepend($regex->hasStartFlag() ? $dir.DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
219+
$regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
220220
} else {
221221
$expr->prepend('*')->append('*');
222222
}

src/Symfony/Component/Finder/Tests/FinderTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,20 @@ public function testIteratorKeys(Adapter\AdapterInterface $adapter)
569569
}
570570
}
571571

572+
/**
573+
* @dataProvider getAdaptersTestData
574+
*/
575+
public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartFlag(Adapter\AdapterInterface $adapter)
576+
{
577+
$finder = $this->buildFinder($adapter);
578+
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.g?e*x[c]a(r)s')
579+
->path('/^dir/');
580+
581+
$expected = array('r+e.g?e*x[c]a(r)s'.DIRECTORY_SEPARATOR.'dir',
582+
'r+e.g?e*x[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat',);
583+
$this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
584+
}
585+
572586
public function testAdaptersOrdering()
573587
{
574588
$finder = Finder::create()

src/Symfony/Component/Finder/Tests/Fixtures/r+e.g?e*x[c]a(r)s/dir/bar.dat

Whitespace-only changes.

src/Symfony/Component/Form/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"symfony/property-access": "~2.3"
2424
},
2525
"require-dev": {
26-
"symfony/validator": "~2.2",
26+
"symfony/validator": "~2.4",
2727
"symfony/http-foundation": "~2.2",
2828
"symfony/http-kernel": "~2.4",
2929
"symfony/security-csrf": "~2.4",

src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,12 @@ protected function forward(Request $request, $catch = false, Response $entry = n
461461
// is always called from the same process as the backend.
462462
$request->server->set('REMOTE_ADDR', '127.0.0.1');
463463

464+
// make sure HttpCache is a trusted proxy
465+
if (!in_array('127.0.0.1', $trustedProxies = Request::getTrustedProxies())) {
466+
$trustedProxies[] = '127.0.0.1';
467+
Request::setTrustedProxies($trustedProxies);
468+
}
469+
464470
// always a "master" request (as the real master request can be in cache)
465471
$response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $catch);
466472
// FIXME: we probably need to also catch exceptions if raw === true
@@ -601,8 +607,6 @@ protected function store(Request $request, Response $response)
601607
*
602608
* @param Request $request A Request instance
603609
* @param Response $response A Response instance
604-
*
605-
* @return Response A Response instance
606610
*/
607611
private function restoreResponseBody(Request $request, Response $response)
608612
{

src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,28 @@ public function testClientIpIsAlwaysLocalhostForForwardedRequests()
11421142
$this->assertEquals('127.0.0.1', $this->kernel->getBackendRequest()->server->get('REMOTE_ADDR'));
11431143
}
11441144

1145+
/**
1146+
* @dataProvider getTrustedProxyData
1147+
*/
1148+
public function testHttpCacheIsSetAsATrustedProxy(array $existing, array $expected)
1149+
{
1150+
Request::setTrustedProxies($existing);
1151+
1152+
$this->setNextResponse();
1153+
$this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1'));
1154+
1155+
$this->assertEquals($expected, Request::getTrustedProxies());
1156+
}
1157+
1158+
public function getTrustedProxyData()
1159+
{
1160+
return array(
1161+
array(array(), array('127.0.0.1')),
1162+
array(array('10.0.0.2'), array('10.0.0.2', '127.0.0.1')),
1163+
array(array('10.0.0.2', '127.0.0.1'), array('10.0.0.2', '127.0.0.1')),
1164+
);
1165+
}
1166+
11451167
/**
11461168
* @dataProvider getXForwardedForData
11471169
*/

src/Symfony/Component/Routing/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
},
2121
"require-dev": {
2222
"symfony/config": "~2.2",
23+
"symfony/http-foundation": "~2.3",
2324
"symfony/yaml": "~2.0",
2425
"symfony/expression-language": "~2.4",
2526
"doctrine/annotations": "~1.0",

src/Symfony/Component/Translation/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
},
2121
"require-dev": {
2222
"symfony/config": "~2.0",
23+
"symfony/intl": "~2.3",
2324
"symfony/yaml": "~2.2"
2425
},
2526
"suggest": {

0 commit comments

Comments
 (0)