Merge branch '2.5'
* 2.5: [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/Component/Form/composer.json
This commit is contained in:
commit
2104813ca2
14
.travis.yml
14
.travis.yml
@ -11,9 +11,16 @@ php:
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm-nightly
|
||||
include:
|
||||
- php: 5.5
|
||||
env: components=yes
|
||||
|
||||
services: mongodb
|
||||
|
||||
env:
|
||||
global:
|
||||
- components=no
|
||||
|
||||
before_install:
|
||||
- travis_retry sudo apt-get install parallel
|
||||
- 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:
|
||||
# - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "5.3.3" ]; then phpunit --self-update; fi;'
|
||||
|
||||
install:
|
||||
- COMPOSER_ROOT_VERSION=dev-master composer --prefer-source install
|
||||
- sh -c 'if [ "$components" = "no" ]; then sh -c "COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install"; fi;'
|
||||
|
||||
script:
|
||||
- ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo "Running {} tests"; phpunit --exclude-group tty,benchmark {};'
|
||||
- echo "Running tests requiring tty"; phpunit --group tty
|
||||
- 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;'
|
||||
- sh -c 'if [ "$components" = "no" ]; then sh -c "echo "\""Running tests requiring tty"\""; phpunit --group tty"; fi;'
|
||||
- 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;'
|
||||
|
@ -26,7 +26,7 @@
|
||||
"symfony/http-kernel": "~2.2",
|
||||
"symfony/security": "~2.2",
|
||||
"symfony/expression-language": "~2.2",
|
||||
"symfony/validator": "~2.2",
|
||||
"symfony/validator": "~2.3.0",
|
||||
"doctrine/data-fixtures": "1.0.*",
|
||||
"doctrine/dbal": "~2.2",
|
||||
"doctrine/orm": "~2.2,>=2.2.3"
|
||||
|
@ -20,6 +20,9 @@
|
||||
"symfony/dependency-injection": "~2.3",
|
||||
"ocramius/proxy-manager": ">=0.3.1,<0.6-dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "2.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Bridge\\ProxyManager\\": ""
|
||||
|
@ -32,11 +32,15 @@
|
||||
"doctrine/annotations": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/browser-kit": "~2.3",
|
||||
"symfony/console": "~2.0",
|
||||
"symfony/finder": "~2.0",
|
||||
"symfony/security": "~2.4",
|
||||
"symfony/form": "~2.3",
|
||||
"symfony/form": "~2.4",
|
||||
"symfony/class-loader": "~2.1",
|
||||
"symfony/validator": "~2.1"
|
||||
"symfony/process": "~2.0",
|
||||
"symfony/validator": "~2.1",
|
||||
"symfony/yaml": "~2.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/console": "For using the console commands",
|
||||
|
@ -21,8 +21,11 @@
|
||||
"symfony/http-kernel": "~2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/browser-kit": "~2.3",
|
||||
"symfony/form": "~2.3",
|
||||
"symfony/framework-bundle": "~2.2",
|
||||
"symfony/twig-bundle": "~2.2",
|
||||
"symfony/process": "~2.0",
|
||||
"symfony/validator": "~2.2",
|
||||
"symfony/yaml": "~2.0",
|
||||
"symfony/expression-language": "~2.4",
|
||||
|
@ -11,12 +11,11 @@
|
||||
|
||||
namespace Symfony\Bundle\WebProfilerBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||
use Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController;
|
||||
use Symfony\Component\HttpKernel\Profiler\Profile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class ProfilerControllerTest extends TestCase
|
||||
class ProfilerControllerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider getEmptyTokenCases
|
||||
|
@ -23,6 +23,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.2",
|
||||
"symfony/console": "~2.3",
|
||||
"symfony/dependency-injection": "~2.0",
|
||||
"symfony/stopwatch": "~2.2"
|
||||
},
|
||||
|
@ -216,7 +216,7 @@ abstract class AbstractFindAdapter extends AbstractAdapter
|
||||
// Fixes 'not search' regex problems.
|
||||
if ($expr->isRegex()) {
|
||||
$regex = $expr->getRegex();
|
||||
$regex->prepend($regex->hasStartFlag() ? $dir.DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
|
||||
$regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
|
||||
} else {
|
||||
$expr->prepend('*')->append('*');
|
||||
}
|
||||
|
@ -580,6 +580,20 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getAdaptersTestData
|
||||
*/
|
||||
public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartFlag(Adapter\AdapterInterface $adapter)
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.g?e*x[c]a(r)s')
|
||||
->path('/^dir/');
|
||||
|
||||
$expected = array('r+e.g?e*x[c]a(r)s'.DIRECTORY_SEPARATOR.'dir',
|
||||
'r+e.g?e*x[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat',);
|
||||
$this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
|
||||
}
|
||||
|
||||
public function testAdaptersOrdering()
|
||||
{
|
||||
$finder = Finder::create()
|
||||
|
@ -23,7 +23,7 @@
|
||||
"symfony/property-access": "~2.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/validator": "~2.3",
|
||||
"symfony/validator": "~2.4",
|
||||
"symfony/http-foundation": "~2.2",
|
||||
"symfony/http-kernel": "~2.4",
|
||||
"symfony/security-csrf": "~2.4",
|
||||
|
@ -479,6 +479,12 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
// is always called from the same process as the backend.
|
||||
$request->server->set('REMOTE_ADDR', '127.0.0.1');
|
||||
|
||||
// make sure HttpCache is a trusted proxy
|
||||
if (!in_array('127.0.0.1', $trustedProxies = Request::getTrustedProxies())) {
|
||||
$trustedProxies[] = '127.0.0.1';
|
||||
Request::setTrustedProxies($trustedProxies);
|
||||
}
|
||||
|
||||
// always a "master" request (as the real master request can be in cache)
|
||||
$response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $catch);
|
||||
// FIXME: we probably need to also catch exceptions if raw === true
|
||||
@ -619,8 +625,6 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
||||
*
|
||||
* @param Request $request A Request instance
|
||||
* @param Response $response A Response instance
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*/
|
||||
private function restoreResponseBody(Request $request, Response $response)
|
||||
{
|
||||
|
@ -1142,6 +1142,28 @@ class HttpCacheTest extends HttpCacheTestCase
|
||||
$this->assertEquals('127.0.0.1', $this->kernel->getBackendRequest()->server->get('REMOTE_ADDR'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getTrustedProxyData
|
||||
*/
|
||||
public function testHttpCacheIsSetAsATrustedProxy(array $existing, array $expected)
|
||||
{
|
||||
Request::setTrustedProxies($existing);
|
||||
|
||||
$this->setNextResponse();
|
||||
$this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1'));
|
||||
|
||||
$this->assertEquals($expected, Request::getTrustedProxies());
|
||||
}
|
||||
|
||||
public function getTrustedProxyData()
|
||||
{
|
||||
return array(
|
||||
array(array(), array('127.0.0.1')),
|
||||
array(array('10.0.0.2'), array('10.0.0.2', '127.0.0.1')),
|
||||
array(array('10.0.0.2', '127.0.0.1'), array('10.0.0.2', '127.0.0.1')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getXForwardedForData
|
||||
*/
|
||||
|
@ -20,6 +20,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.2",
|
||||
"symfony/http-foundation": "~2.3",
|
||||
"symfony/yaml": "~2.0",
|
||||
"symfony/expression-language": "~2.4",
|
||||
"doctrine/annotations": "~1.0",
|
||||
|
@ -20,6 +20,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.0",
|
||||
"symfony/intl": "~2.3",
|
||||
"symfony/yaml": "~2.2"
|
||||
},
|
||||
"suggest": {
|
||||
|
Reference in New Issue
Block a user