Merge branch '2.3' into 2.7
* 2.3: remove unnecessary retrieval and setting of data avoid (string) catchable fatal error for __PHP_Incomplete_Class instances sendContent return as parent. [FrameworkBundle] Fix a typo
This commit is contained in:
commit
4598b74906
@ -46,8 +46,9 @@ class TranslationUpdateCommand extends ContainerAwareCommand
|
|||||||
))
|
))
|
||||||
->setDescription('Updates the translation file')
|
->setDescription('Updates the translation file')
|
||||||
->setHelp(<<<'EOF'
|
->setHelp(<<<'EOF'
|
||||||
The <info>%command.name%</info> command extract translation strings from templates
|
The <info>%command.name%</info> command extracts translation strings from templates
|
||||||
of a given bundle or the app folder. It can display them or merge the new ones into the translation files.
|
of a given bundle or the app folder. It can display them or merge the new ones into the translation files.
|
||||||
|
|
||||||
When new translation strings are found it can automatically add a prefix to the translation
|
When new translation strings are found it can automatically add a prefix to the translation
|
||||||
message.
|
message.
|
||||||
|
|
||||||
|
@ -94,9 +94,10 @@ class CsrfValidationListener implements EventSubscriberInterface
|
|||||||
public function preSubmit(FormEvent $event)
|
public function preSubmit(FormEvent $event)
|
||||||
{
|
{
|
||||||
$form = $event->getForm();
|
$form = $event->getForm();
|
||||||
$data = $event->getData();
|
|
||||||
|
|
||||||
if ($form->isRoot() && $form->getConfig()->getOption('compound')) {
|
if ($form->isRoot() && $form->getConfig()->getOption('compound')) {
|
||||||
|
$data = $event->getData();
|
||||||
|
|
||||||
if (!isset($data[$this->fieldName]) || !$this->tokenManager->isTokenValid(new CsrfToken($this->tokenId, $data[$this->fieldName]))) {
|
if (!isset($data[$this->fieldName]) || !$this->tokenManager->isTokenValid(new CsrfToken($this->tokenId, $data[$this->fieldName]))) {
|
||||||
$errorMessage = $this->errorMessage;
|
$errorMessage = $this->errorMessage;
|
||||||
|
|
||||||
@ -109,10 +110,9 @@ class CsrfValidationListener implements EventSubscriberInterface
|
|||||||
|
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
unset($data[$this->fieldName]);
|
unset($data[$this->fieldName]);
|
||||||
|
$event->setData($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setData($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,6 +27,9 @@ class BinaryFileResponse extends Response
|
|||||||
{
|
{
|
||||||
protected static $trustXSendfileTypeHeader = false;
|
protected static $trustXSendfileTypeHeader = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var File
|
||||||
|
*/
|
||||||
protected $file;
|
protected $file;
|
||||||
protected $offset;
|
protected $offset;
|
||||||
protected $maxlen;
|
protected $maxlen;
|
||||||
@ -180,7 +183,7 @@ class BinaryFileResponse extends Response
|
|||||||
$this->headers->set('Content-Type', $this->file->getMimeType() ?: 'application/octet-stream');
|
$this->headers->set('Content-Type', $this->file->getMimeType() ?: 'application/octet-stream');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('HTTP/1.0' != $request->server->get('SERVER_PROTOCOL')) {
|
if ('HTTP/1.0' !== $request->server->get('SERVER_PROTOCOL')) {
|
||||||
$this->setProtocolVersion('1.1');
|
$this->setProtocolVersion('1.1');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,17 +200,17 @@ class BinaryFileResponse extends Response
|
|||||||
if (false === $path) {
|
if (false === $path) {
|
||||||
$path = $this->file->getPathname();
|
$path = $this->file->getPathname();
|
||||||
}
|
}
|
||||||
if (strtolower($type) == 'x-accel-redirect') {
|
if (strtolower($type) === 'x-accel-redirect') {
|
||||||
// Do X-Accel-Mapping substitutions.
|
// Do X-Accel-Mapping substitutions.
|
||||||
// @link http://wiki.nginx.org/X-accel#X-Accel-Redirect
|
// @link http://wiki.nginx.org/X-accel#X-Accel-Redirect
|
||||||
foreach (explode(',', $request->headers->get('X-Accel-Mapping', '')) as $mapping) {
|
foreach (explode(',', $request->headers->get('X-Accel-Mapping', '')) as $mapping) {
|
||||||
$mapping = explode('=', $mapping, 2);
|
$mapping = explode('=', $mapping, 2);
|
||||||
|
|
||||||
if (2 == count($mapping)) {
|
if (2 === count($mapping)) {
|
||||||
$pathPrefix = trim($mapping[0]);
|
$pathPrefix = trim($mapping[0]);
|
||||||
$location = trim($mapping[1]);
|
$location = trim($mapping[1]);
|
||||||
|
|
||||||
if (substr($path, 0, strlen($pathPrefix)) == $pathPrefix) {
|
if (substr($path, 0, strlen($pathPrefix)) === $pathPrefix) {
|
||||||
$path = $location.substr($path, strlen($pathPrefix));
|
$path = $location.substr($path, strlen($pathPrefix));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -218,7 +221,7 @@ class BinaryFileResponse extends Response
|
|||||||
$this->maxlen = 0;
|
$this->maxlen = 0;
|
||||||
} elseif ($request->headers->has('Range')) {
|
} elseif ($request->headers->has('Range')) {
|
||||||
// Process the range headers.
|
// Process the range headers.
|
||||||
if (!$request->headers->has('If-Range') || $this->getEtag() == $request->headers->get('If-Range')) {
|
if (!$request->headers->has('If-Range') || $this->getEtag() === $request->headers->get('If-Range')) {
|
||||||
$range = $request->headers->get('Range');
|
$range = $request->headers->get('Range');
|
||||||
$fileSize = $this->file->getSize();
|
$fileSize = $this->file->getSize();
|
||||||
|
|
||||||
@ -253,17 +256,17 @@ class BinaryFileResponse extends Response
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends the file.
|
* Sends the file.
|
||||||
|
*
|
||||||
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function sendContent()
|
public function sendContent()
|
||||||
{
|
{
|
||||||
if (!$this->isSuccessful()) {
|
if (!$this->isSuccessful()) {
|
||||||
parent::sendContent();
|
return parent::sendContent();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === $this->maxlen) {
|
if (0 === $this->maxlen) {
|
||||||
return;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out = fopen('php://output', 'wb');
|
$out = fopen('php://output', 'wb');
|
||||||
@ -277,6 +280,8 @@ class BinaryFileResponse extends Response
|
|||||||
if ($this->deleteFileAfterSend) {
|
if ($this->deleteFileAfterSend) {
|
||||||
unlink($this->file->getPathname());
|
unlink($this->file->getPathname());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user