Merge branch '3.3' into 3.4

* 3.3:
  [Profiler] Fix request_collector check in main layout
  Github template: Remove EOM 3.2 from branch suggestion
  [Security] Fix security.interactive_login event const doc block
  Update Container.php: Deprecated -> @deprecated
  allow phpdocumentor/reflection-docblock >=3.2.1
  Avoid infinite loops when profiler data is malformed
  [FrameworkBundle] Warmup annotations for bundle-less controllers and entities
  [HttpFoundation] Generate safe fallback filename for wrongly encoded filename
This commit is contained in:
Nicolas Grekas 2017-08-06 15:42:33 +02:00
commit 8be06c45f9
10 changed files with 36 additions and 14 deletions

View File

@ -1,6 +1,6 @@
| Q | A
| ------------- | ---
| Branch? | 3.4 or master / 2.7, 2.8, 3.2 or 3.3 <!-- see comment below -->
| Branch? | 3.4 or master / 2.7, 2.8 or 3.3 <!-- see comment below -->
| Bug fix? | yes/no
| New feature? | yes/no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | yes/no

View File

@ -102,7 +102,7 @@
"phpdocumentor/reflection-docblock": "^3.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0",
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.1",
"phpdocumentor/type-resolver": "<0.2.0",
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
},

View File

@ -259,8 +259,8 @@ class FrameworkExtension extends Extension
}
$this->addAnnotatedClassesToCompile(array(
'**Bundle\\Controller\\',
'**Bundle\\Entity\\',
'**\\Controller\\',
'**\\Entity\\',
// Added explicitly so that we don't rely on the class map being dumped to make it work
'Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller',

View File

@ -20,7 +20,7 @@
</h2>
{% set request_collector = profile.collectors.request|default(false) %}
{% if request_collector is defined and request_collector.redirect -%}
{% if request_collector and request_collector.redirect -%}
{%- set redirect = request_collector.redirect -%}
{%- set controller = redirect.controller -%}
{%- set redirect_route = '@' ~ redirect.route %}

View File

@ -111,7 +111,7 @@ class Container implements ResettableContainerInterface
/**
* Returns true if the container parameter bag are frozen.
*
* Deprecated since 3.3, to be removed in 4.0.
* @deprecated since version 3.3, to be removed in 4.0.
*
* @return bool true if the container parameter bag are frozen, false otherwise
*/

View File

@ -150,7 +150,7 @@ class BinaryFileResponse extends Response
* Sets the Content-Disposition header with the given filename.
*
* @param string $disposition ResponseHeaderBag::DISPOSITION_INLINE or ResponseHeaderBag::DISPOSITION_ATTACHMENT
* @param string $filename Optionally use this filename instead of the real name of the file
* @param string $filename Optionally use this UTF-8 encoded filename instead of the real name of the file
* @param string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename
*
* @return $this
@ -162,7 +162,7 @@ class BinaryFileResponse extends Response
}
if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) {
$encoding = mb_detect_encoding($filename, null, true);
$encoding = mb_detect_encoding($filename, null, true) ?: '8bit';
for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) {
$char = mb_substr($filename, $i, 1, $encoding);

View File

@ -69,6 +69,17 @@ class BinaryFileResponseTest extends ResponseTestCase
$this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%C3%B6%C3%B6.html', $response->headers->get('Content-Disposition'));
}
public function testSetContentDispositionGeneratesSafeFallbackFilenameForWronglyEncodedFilename()
{
$response = new BinaryFileResponse(__FILE__);
$iso88591EncodedFilename = utf8_decode('föö.html');
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $iso88591EncodedFilename);
// the parameter filename* is invalid in this case (rawurldecode('f%F6%F6') does not provide a UTF-8 string but an ISO-8859-1 encoded one)
$this->assertSame('attachment; filename="f__.html"; filename*=utf-8\'\'f%F6%F6.html', $response->headers->get('Content-Disposition'));
}
/**
* @dataProvider provideRanges
*/

View File

@ -142,11 +142,19 @@ class FileProfilerStorage implements ProfilerStorageInterface
}
}
$profileToken = $profile->getToken();
// when there are errors in sub-requests, the parent and/or children tokens
// may equal the profile token, resulting in infinite loops
$parentToken = $profile->getParentToken() !== $profileToken ? $profile->getParentToken() : null;
$childrenToken = array_filter(array_map(function ($p) use ($profileToken) {
return $profileToken !== $p->getToken() ? $p->getToken() : null;
}, $profile->getChildren()));
// Store profile
$data = array(
'token' => $profile->getToken(),
'parent' => $profile->getParentToken(),
'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()),
'token' => $profileToken,
'parent' => $parentToken,
'children' => $childrenToken,
'data' => $profile->getCollectors(),
'ip' => $profile->getIp(),
'method' => $profile->getMethod(),

View File

@ -34,7 +34,7 @@
"doctrine/annotations": "~1.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0",
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.1",
"phpdocumentor/type-resolver": "<0.2.0",
"symfony/dependency-injection": "<3.3"
},

View File

@ -14,8 +14,11 @@ namespace Symfony\Component\Security\Http;
final class SecurityEvents
{
/**
* The INTERACTIVE_LOGIN event occurs after a user is logged in
* interactively for authentication based on http, cookies or X509.
* The INTERACTIVE_LOGIN event occurs after a user has actively logged
* into your website. It is important to distinguish this action from
* non-interactive authentication methods, such as:
* - authentication based on your session.
* - authentication using a HTTP basic or HTTP digest header.
*
* @Event("Symfony\Component\Security\Http\Event\InteractiveLoginEvent")
*