Merge branch '2.3' into 2.6
* 2.3: Improve the config validation in TwigBundle [Security][Acl] enforce string identifiers [BrowserKit] Fix bug when uri starts with http. bumped Symfony version to 2.3.31 updated VERSION for 2.3.30 updated CHANGELOG for 2.3.30 Php Inspections (EA Extended): - resolved possible PHP Fatal in \Symfony\Component\BrowserKit\Cookie::__toString -resolved implicit magic methods calls -resolved callable name case mismatches Conflicts: src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php src/Symfony/Component/HttpKernel/Kernel.php
This commit is contained in:
commit
1c4c0435b4
@ -7,6 +7,10 @@ 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 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
|
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1
|
||||||
|
|
||||||
|
* 2.3.30 (2015-05-30)
|
||||||
|
|
||||||
|
* bug #14262 [REVERTED] [TwigBundle] Refresh twig paths when resources change. (aitboudad)
|
||||||
|
|
||||||
* 2.3.29 (2015-05-26)
|
* 2.3.29 (2015-05-26)
|
||||||
|
|
||||||
* security #14759 CVE-2015-4050 [HttpKernel] Do not call the FragmentListener if _controller is already defined (jakzal)
|
* security #14759 CVE-2015-4050 [HttpKernel] Do not call the FragmentListener if _controller is already defined (jakzal)
|
||||||
|
@ -161,13 +161,13 @@ class Configuration implements ConfigurationInterface
|
|||||||
->end()
|
->end()
|
||||||
->scalarNode('autoescape_service')->defaultNull()->end()
|
->scalarNode('autoescape_service')->defaultNull()->end()
|
||||||
->scalarNode('autoescape_service_method')->defaultNull()->end()
|
->scalarNode('autoescape_service_method')->defaultNull()->end()
|
||||||
->scalarNode('base_template_class')->example('Twig_Template')->end()
|
->scalarNode('base_template_class')->example('Twig_Template')->cannotBeEmpty()->end()
|
||||||
->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end()
|
->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end()
|
||||||
->scalarNode('charset')->defaultValue('%kernel.charset%')->end()
|
->scalarNode('charset')->defaultValue('%kernel.charset%')->end()
|
||||||
->scalarNode('debug')->defaultValue('%kernel.debug%')->end()
|
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
|
||||||
->scalarNode('strict_variables')->end()
|
->booleanNode('strict_variables')->end()
|
||||||
->scalarNode('auto_reload')->end()
|
->scalarNode('auto_reload')->end()
|
||||||
->scalarNode('optimizations')->end()
|
->integerNode('optimizations')->min(-1)->end()
|
||||||
->arrayNode('paths')
|
->arrayNode('paths')
|
||||||
->normalizeKeys(false)
|
->normalizeKeys(false)
|
||||||
->useAttributeAsKey('paths')
|
->useAttributeAsKey('paths')
|
||||||
|
@ -547,7 +547,7 @@ abstract class Client
|
|||||||
protected function getAbsoluteUri($uri)
|
protected function getAbsoluteUri($uri)
|
||||||
{
|
{
|
||||||
// already absolute?
|
// already absolute?
|
||||||
if (0 === strpos($uri, 'http')) {
|
if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) {
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,11 +69,20 @@ class Cookie
|
|||||||
$this->rawValue = urlencode($value);
|
$this->rawValue = urlencode($value);
|
||||||
}
|
}
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->expires = null === $expires ? null : (int) $expires;
|
|
||||||
$this->path = empty($path) ? '/' : $path;
|
$this->path = empty($path) ? '/' : $path;
|
||||||
$this->domain = $domain;
|
$this->domain = $domain;
|
||||||
$this->secure = (bool) $secure;
|
$this->secure = (bool) $secure;
|
||||||
$this->httponly = (bool) $httponly;
|
$this->httponly = (bool) $httponly;
|
||||||
|
|
||||||
|
if (null !== $expires) {
|
||||||
|
$timestampAsDateTime = \DateTime::createFromFormat('U', $expires);
|
||||||
|
if (false === $timestampAsDateTime) {
|
||||||
|
throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $expires);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->expires = $timestampAsDateTime->getTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,12 +100,6 @@ class Cookie
|
|||||||
|
|
||||||
if (null !== $this->expires) {
|
if (null !== $this->expires) {
|
||||||
$dateTime = \DateTime::createFromFormat('U', $this->expires, new \DateTimeZone('GMT'));
|
$dateTime = \DateTime::createFromFormat('U', $this->expires, new \DateTimeZone('GMT'));
|
||||||
|
|
||||||
if ($dateTime === false) {
|
|
||||||
// this throw will provoke PHP fatal
|
|
||||||
throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $this->expires);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::$dateFormats[0]));
|
$cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::$dateFormats[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +207,21 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$client->request('GET', 'bar');
|
$client->request('GET', 'bar');
|
||||||
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
|
|
||||||
|
$client = new TestClient();
|
||||||
|
$client->request('GET', 'http://www.example.com/foo/');
|
||||||
|
$client->request('GET', 'http');
|
||||||
|
$this->assertEquals('http://www.example.com/foo/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
|
|
||||||
|
$client = new TestClient();
|
||||||
|
$client->request('GET', 'http://www.example.com/foo');
|
||||||
|
$client->request('GET', 'http/bar');
|
||||||
|
$this->assertEquals('http://www.example.com/http/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
|
|
||||||
|
$client = new TestClient();
|
||||||
|
$client->request('GET', 'http://www.example.com/');
|
||||||
|
$client->request('GET', 'http');
|
||||||
|
$this->assertEquals('http://www.example.com/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestURIConversionByServerHost()
|
public function testRequestURIConversionByServerHost()
|
||||||
@ -332,7 +347,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
$client->followRedirect();
|
$client->followRedirect();
|
||||||
$this->fail('->followRedirect() throws a \LogicException if the request was not redirected');
|
$this->fail('->followRedirect() throws a \LogicException if the request was not redirected');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceof('LogicException', $e, '->followRedirect() throws a \LogicException if the request was not redirected');
|
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was not redirected');
|
||||||
}
|
}
|
||||||
|
|
||||||
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
|
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
|
||||||
@ -362,7 +377,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
$client->followRedirect();
|
$client->followRedirect();
|
||||||
$this->fail('->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
|
$this->fail('->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceof('LogicException', $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
|
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +407,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
$client->followRedirect();
|
$client->followRedirect();
|
||||||
$this->fail('->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
|
$this->fail('->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceof('LogicException', $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
|
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
|
||||||
}
|
}
|
||||||
|
|
||||||
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
|
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
|
||||||
@ -562,7 +577,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$this->fail('->request() throws a \RuntimeException if the script has an error');
|
$this->fail('->request() throws a \RuntimeException if the script has an error');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceof('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
|
$this->assertInstanceOf('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,30 +74,30 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testFromStringWithUrl()
|
public function testFromStringWithUrl()
|
||||||
{
|
{
|
||||||
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar', 'http://www.example.com/'));
|
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar', 'http://www.example.com/'));
|
||||||
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar', 'http://www.example.com'));
|
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar', 'http://www.example.com'));
|
||||||
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar', 'http://www.example.com?foo'));
|
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar', 'http://www.example.com?foo'));
|
||||||
$this->assertEquals('foo=bar; domain=www.example.com; path=/foo', (string) Cookie::FromString('foo=bar', 'http://www.example.com/foo/bar'));
|
$this->assertEquals('foo=bar; domain=www.example.com; path=/foo', (string) Cookie::fromString('foo=bar', 'http://www.example.com/foo/bar'));
|
||||||
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar; path=/', 'http://www.example.com/foo/bar'));
|
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar; path=/', 'http://www.example.com/foo/bar'));
|
||||||
$this->assertEquals('foo=bar; domain=www.myotherexample.com; path=/', (string) Cookie::FromString('foo=bar; domain=www.myotherexample.com', 'http://www.example.com/'));
|
$this->assertEquals('foo=bar; domain=www.myotherexample.com; path=/', (string) Cookie::fromString('foo=bar; domain=www.myotherexample.com', 'http://www.example.com/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
|
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
|
||||||
{
|
{
|
||||||
$this->setExpectedException('InvalidArgumentException');
|
$this->setExpectedException('InvalidArgumentException');
|
||||||
Cookie::FromString('foo');
|
Cookie::fromString('foo');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
|
public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
|
||||||
{
|
{
|
||||||
$this->setExpectedException('InvalidArgumentException');
|
$this->setExpectedException('InvalidArgumentException');
|
||||||
Cookie::FromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
|
Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
|
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
|
||||||
{
|
{
|
||||||
$this->setExpectedException('InvalidArgumentException');
|
$this->setExpectedException('InvalidArgumentException');
|
||||||
Cookie::FromString('foo=bar', 'foobar');
|
Cookie::fromString('foo=bar', 'foobar');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetName()
|
public function testGetName()
|
||||||
|
@ -54,7 +54,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$history->current();
|
$history->current();
|
||||||
$this->fail('->current() throws a \LogicException if the history is empty');
|
$this->fail('->current() throws a \LogicException if the history is empty');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceof('LogicException', $e, '->current() throws a \LogicException if the history is empty');
|
$this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
$history->add(new Request('http://www.example.com/', 'get'));
|
$history->add(new Request('http://www.example.com/', 'get'));
|
||||||
@ -71,7 +71,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$history->back();
|
$history->back();
|
||||||
$this->fail('->back() throws a \LogicException if the history is already on the first page');
|
$this->fail('->back() throws a \LogicException if the history is already on the first page');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceof('LogicException', $e, '->current() throws a \LogicException if the history is already on the first page');
|
$this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is already on the first page');
|
||||||
}
|
}
|
||||||
|
|
||||||
$history->add(new Request('http://www.example1.com/', 'get'));
|
$history->add(new Request('http://www.example1.com/', 'get'));
|
||||||
@ -90,7 +90,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$history->forward();
|
$history->forward();
|
||||||
$this->fail('->forward() throws a \LogicException if the history is already on the last page');
|
$this->fail('->forward() throws a \LogicException if the history is already on the last page');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceof('LogicException', $e, '->forward() throws a \LogicException if the history is already on the last page');
|
$this->assertInstanceOf('LogicException', $e, '->forward() throws a \LogicException if the history is already on the last page');
|
||||||
}
|
}
|
||||||
|
|
||||||
$history->back();
|
$history->back();
|
||||||
|
@ -262,7 +262,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||||||
public function testSort($adapter)
|
public function testSort($adapter)
|
||||||
{
|
{
|
||||||
$finder = $this->buildFinder($adapter);
|
$finder = $this->buildFinder($adapter);
|
||||||
$this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }));
|
$this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }));
|
||||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ class SortableIteratorTest extends RealIteratorTestCase
|
|||||||
array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)),
|
array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)),
|
||||||
array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)),
|
array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)),
|
||||||
array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)),
|
array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)),
|
||||||
array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }, $this->toAbsolute($customComparison)),
|
array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, $this->toAbsolute($customComparison)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->inputTimezone !== $this->outputTimezone) {
|
if ($this->inputTimezone !== $this->outputTimezone) {
|
||||||
$dateTime->setTimeZone(new \DateTimeZone($this->inputTimezone));
|
$dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));
|
||||||
}
|
}
|
||||||
} catch (TransformationFailedException $e) {
|
} catch (TransformationFailedException $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
|
@ -60,7 +60,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||||||
try {
|
try {
|
||||||
// Wrap in <root> node so we can load HTML with multiple tags at
|
// Wrap in <root> node so we can load HTML with multiple tags at
|
||||||
// the top level
|
// the top level
|
||||||
$dom->loadXml('<root>'.$html.'</root>');
|
$dom->loadXML('<root>'.$html.'</root>');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->fail(sprintf(
|
$this->fail(sprintf(
|
||||||
"Failed loading HTML:\n\n%s\n\nError: %s",
|
"Failed loading HTML:\n\n%s\n\nError: %s",
|
||||||
|
@ -147,7 +147,7 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
|
|||||||
|
|
||||||
$output = new \DateTime('2010-02-03 16:05:06 Asia/Hong_Kong');
|
$output = new \DateTime('2010-02-03 16:05:06 Asia/Hong_Kong');
|
||||||
$input = $output->format('Y-m-d H:i:s');
|
$input = $output->format('Y-m-d H:i:s');
|
||||||
$output->setTimeZone(new \DateTimeZone('America/New_York'));
|
$output->setTimezone(new \DateTimeZone('America/New_York'));
|
||||||
|
|
||||||
$this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
|
$this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
|
||||||
}
|
}
|
||||||
|
@ -1080,7 +1080,7 @@ class Response
|
|||||||
$lastModified = $this->headers->get('Last-Modified');
|
$lastModified = $this->headers->get('Last-Modified');
|
||||||
$modifiedSince = $request->headers->get('If-Modified-Since');
|
$modifiedSince = $request->headers->get('If-Modified-Since');
|
||||||
|
|
||||||
if ($etags = $request->getEtags()) {
|
if ($etags = $request->getETags()) {
|
||||||
$notModified = in_array($this->getEtag(), $etags) || in_array('*', $etags);
|
$notModified = in_array($this->getEtag(), $etags) || in_array('*', $etags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ class BinaryFileResponseTest extends ResponseTestCase
|
|||||||
|
|
||||||
$file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
|
$file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
|
||||||
|
|
||||||
BinaryFileResponse::trustXSendFileTypeHeader();
|
BinaryFileResponse::trustXSendfileTypeHeader();
|
||||||
$response = new BinaryFileResponse($file);
|
$response = new BinaryFileResponse($file);
|
||||||
$reflection = new \ReflectionObject($response);
|
$reflection = new \ReflectionObject($response);
|
||||||
$property = $reflection->getProperty('file');
|
$property = $reflection->getProperty('file');
|
||||||
|
@ -125,7 +125,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
|||||||
$this->data['controller'] = array(
|
$this->data['controller'] = array(
|
||||||
'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0],
|
'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0],
|
||||||
'method' => $controller[1],
|
'method' => $controller[1],
|
||||||
'file' => $r->getFilename(),
|
'file' => $r->getFileName(),
|
||||||
'line' => $r->getStartLine(),
|
'line' => $r->getStartLine(),
|
||||||
);
|
);
|
||||||
} catch (\ReflectionException $re) {
|
} catch (\ReflectionException $re) {
|
||||||
@ -144,7 +144,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
|||||||
$this->data['controller'] = array(
|
$this->data['controller'] = array(
|
||||||
'class' => $r->getName(),
|
'class' => $r->getName(),
|
||||||
'method' => null,
|
'method' => null,
|
||||||
'file' => $r->getFilename(),
|
'file' => $r->getFileName(),
|
||||||
'line' => $r->getStartLine(),
|
'line' => $r->getStartLine(),
|
||||||
);
|
);
|
||||||
} elseif (is_object($controller)) {
|
} elseif (is_object($controller)) {
|
||||||
|
@ -386,7 +386,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||||||
// We keep the etags from the client to handle the case when the client
|
// We keep the etags from the client to handle the case when the client
|
||||||
// has a different private valid entry which is not cached here.
|
// has a different private valid entry which is not cached here.
|
||||||
$cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array();
|
$cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array();
|
||||||
$requestEtags = $request->getEtags();
|
$requestEtags = $request->getETags();
|
||||||
if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) {
|
if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) {
|
||||||
$subRequest->headers->set('if_none_match', implode(', ', $etags));
|
$subRequest->headers->set('if_none_match', implode(', ', $etags));
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
|
|||||||
$port = $matches[3];
|
$port = $matches[3];
|
||||||
|
|
||||||
$memcache = new \Memcache();
|
$memcache = new \Memcache();
|
||||||
$memcache->addServer($host, $port);
|
$memcache->addserver($host, $port);
|
||||||
|
|
||||||
$this->memcache = $memcache;
|
$this->memcache = $memcache;
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@ class ConfigDataCollectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// if else clause because we don't know it
|
// if else clause because we don't know it
|
||||||
if (extension_loaded('xdebug')) {
|
if (extension_loaded('xdebug')) {
|
||||||
$this->assertTrue($c->hasXdebug());
|
$this->assertTrue($c->hasXDebug());
|
||||||
} else {
|
} else {
|
||||||
$this->assertFalse($c->hasXdebug());
|
$this->assertFalse($c->hasXDebug());
|
||||||
}
|
}
|
||||||
|
|
||||||
// if else clause because we don't know it
|
// if else clause because we don't know it
|
||||||
|
@ -875,7 +875,7 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$dateTime = new \DateTime();
|
$dateTime = new \DateTime();
|
||||||
$dateTime->setTimestamp(null === $timestamp ? time() : $timestamp);
|
$dateTime->setTimestamp(null === $timestamp ? time() : $timestamp);
|
||||||
$dateTime->setTimeZone(new \DateTimeZone($timeZone));
|
$dateTime->setTimezone(new \DateTimeZone($timeZone));
|
||||||
|
|
||||||
return $dateTime;
|
return $dateTime;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class PhpExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
|||||||
//TODO maybe php executable is custom or even Windows
|
//TODO maybe php executable is custom or even Windows
|
||||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||||
$this->assertTrue(is_executable($current));
|
$this->assertTrue(is_executable($current));
|
||||||
$this->assertTrue((bool) preg_match('/'.addSlashes(DIRECTORY_SEPARATOR).'php\.(exe|bat|cmd|com)$/i', $current), '::find() returns the executable PHP with suffixes');
|
$this->assertTrue((bool) preg_match('/'.addslashes(DIRECTORY_SEPARATOR).'php\.(exe|bat|cmd|com)$/i', $current), '::find() returns the executable PHP with suffixes');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ final class ObjectIdentity implements ObjectIdentityInterface
|
|||||||
*/
|
*/
|
||||||
public function __construct($identifier, $type)
|
public function __construct($identifier, $type)
|
||||||
{
|
{
|
||||||
if (empty($identifier)) {
|
if ('' === $identifier) {
|
||||||
throw new \InvalidArgumentException('$identifier cannot be empty.');
|
throw new \InvalidArgumentException('$identifier cannot be empty.');
|
||||||
}
|
}
|
||||||
if (empty($type)) {
|
if (empty($type)) {
|
||||||
@ -66,7 +66,7 @@ final class ObjectIdentity implements ObjectIdentityInterface
|
|||||||
if ($domainObject instanceof DomainObjectInterface) {
|
if ($domainObject instanceof DomainObjectInterface) {
|
||||||
return new self($domainObject->getObjectIdentifier(), ClassUtils::getRealClass($domainObject));
|
return new self($domainObject->getObjectIdentifier(), ClassUtils::getRealClass($domainObject));
|
||||||
} elseif (method_exists($domainObject, 'getId')) {
|
} elseif (method_exists($domainObject, 'getId')) {
|
||||||
return new self($domainObject->getId(), ClassUtils::getRealClass($domainObject));
|
return new self((string) $domainObject->getId(), ClassUtils::getRealClass($domainObject));
|
||||||
}
|
}
|
||||||
} catch (\InvalidArgumentException $invalid) {
|
} catch (\InvalidArgumentException $invalid) {
|
||||||
throw new InvalidDomainObjectException($invalid->getMessage(), 0, $invalid);
|
throw new InvalidDomainObjectException($invalid->getMessage(), 0, $invalid);
|
||||||
|
@ -36,7 +36,7 @@ class EntryTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue($ace->isAuditSuccess());
|
$this->assertTrue($ace->isAuditSuccess());
|
||||||
$ace->setAuditSuccess(false);
|
$ace->setAuditSuccess(false);
|
||||||
$this->assertFalse($ace->isAuditSuccess());
|
$this->assertFalse($ace->isAuditSuccess());
|
||||||
$ace->setAuditsuccess(true);
|
$ace->setAuditSuccess(true);
|
||||||
$this->assertTrue($ace->isAuditSuccess());
|
$this->assertTrue($ace->isAuditSuccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,26 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
|
|||||||
$this->assertEquals('Symfony\Component\Security\Acl\Tests\Domain\TestDomainObject', $id->getType());
|
$this->assertEquals('Symfony\Component\Security\Acl\Tests\Domain\TestDomainObject', $id->getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFromDomainObjectWithoutInterfaceEnforcesStringIdentifier()
|
||||||
|
{
|
||||||
|
$domainObject = new TestDomainObject();
|
||||||
|
$domainObject->id = 1;
|
||||||
|
$id = ObjectIdentity::fromDomainObject($domainObject);
|
||||||
|
|
||||||
|
$this->assertSame('1', $id->getIdentifier());
|
||||||
|
$this->assertEquals('Symfony\Component\Security\Tests\Acl\Domain\TestDomainObject', $id->getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFromDomainObjectWithoutInterfaceAllowsZeroAsIdentifier()
|
||||||
|
{
|
||||||
|
$domainObject = new TestDomainObject();
|
||||||
|
$domainObject->id = '0';
|
||||||
|
$id = ObjectIdentity::fromDomainObject($domainObject);
|
||||||
|
|
||||||
|
$this->assertSame('0', $id->getIdentifier());
|
||||||
|
$this->assertEquals('Symfony\Component\Security\Tests\Acl\Domain\TestDomainObject', $id->getType());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getCompareData
|
* @dataProvider getCompareData
|
||||||
*/
|
*/
|
||||||
@ -89,6 +109,8 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
|
|||||||
|
|
||||||
class TestDomainObject
|
class TestDomainObject
|
||||||
{
|
{
|
||||||
|
public $id = 'getId()';
|
||||||
|
|
||||||
public function getObjectIdentifier()
|
public function getObjectIdentifier()
|
||||||
{
|
{
|
||||||
return 'getObjectIdentifier()';
|
return 'getObjectIdentifier()';
|
||||||
@ -96,7 +118,7 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
|
|||||||
|
|
||||||
public function getId()
|
public function getId()
|
||||||
{
|
{
|
||||||
return 'getId()';
|
return $this->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase
|
|||||||
$stopwatch = new Stopwatch();
|
$stopwatch = new Stopwatch();
|
||||||
$event = $stopwatch->start('foo', 'cat');
|
$event = $stopwatch->start('foo', 'cat');
|
||||||
|
|
||||||
$this->assertInstanceof('Symfony\Component\Stopwatch\StopwatchEvent', $event);
|
$this->assertInstanceOf('Symfony\Component\Stopwatch\StopwatchEvent', $event);
|
||||||
$this->assertEquals('cat', $event->getCategory());
|
$this->assertEquals('cat', $event->getCategory());
|
||||||
$this->assertSame($event, $stopwatch->getEvent('foo'));
|
$this->assertSame($event, $stopwatch->getEvent('foo'));
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase
|
|||||||
usleep(200000);
|
usleep(200000);
|
||||||
$event = $stopwatch->stop('foo');
|
$event = $stopwatch->stop('foo');
|
||||||
|
|
||||||
$this->assertInstanceof('Symfony\Component\Stopwatch\StopwatchEvent', $event);
|
$this->assertInstanceOf('Symfony\Component\Stopwatch\StopwatchEvent', $event);
|
||||||
$this->assertEquals(200, $event->getDuration(), null, self::DELTA);
|
$this->assertEquals(200, $event->getDuration(), null, self::DELTA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user