Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4598b74

Browse filesBrowse files
committed
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
2 parents ae0b5fa + 81d654f commit 4598b74
Copy full SHA for 4598b74

File tree

3 files changed

+19
-13
lines changed
Filter options

3 files changed

+19
-13
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ protected function configure()
4646
))
4747
->setDescription('Updates the translation file')
4848
->setHelp(<<<'EOF'
49-
The <info>%command.name%</info> command extract translation strings from templates
49+
The <info>%command.name%</info> command extracts translation strings from templates
5050
of a given bundle or the app folder. It can display them or merge the new ones into the translation files.
51+
5152
When new translation strings are found it can automatically add a prefix to the translation
5253
message.
5354

‎src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ public function __construct($fieldName, $tokenManager, $tokenId, $errorMessage,
9494
public function preSubmit(FormEvent $event)
9595
{
9696
$form = $event->getForm();
97-
$data = $event->getData();
9897

9998
if ($form->isRoot() && $form->getConfig()->getOption('compound')) {
99+
$data = $event->getData();
100+
100101
if (!isset($data[$this->fieldName]) || !$this->tokenManager->isTokenValid(new CsrfToken($this->tokenId, $data[$this->fieldName]))) {
101102
$errorMessage = $this->errorMessage;
102103

@@ -109,10 +110,9 @@ public function preSubmit(FormEvent $event)
109110

110111
if (is_array($data)) {
111112
unset($data[$this->fieldName]);
113+
$event->setData($data);
112114
}
113115
}
114-
115-
$event->setData($data);
116116
}
117117

118118
/**

‎src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
+14-9Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class BinaryFileResponse extends Response
2727
{
2828
protected static $trustXSendfileTypeHeader = false;
2929

30+
/**
31+
* @var File
32+
*/
3033
protected $file;
3134
protected $offset;
3235
protected $maxlen;
@@ -180,7 +183,7 @@ public function prepare(Request $request)
180183
$this->headers->set('Content-Type', $this->file->getMimeType() ?: 'application/octet-stream');
181184
}
182185

183-
if ('HTTP/1.0' != $request->server->get('SERVER_PROTOCOL')) {
186+
if ('HTTP/1.0' !== $request->server->get('SERVER_PROTOCOL')) {
184187
$this->setProtocolVersion('1.1');
185188
}
186189

@@ -197,17 +200,17 @@ public function prepare(Request $request)
197200
if (false === $path) {
198201
$path = $this->file->getPathname();
199202
}
200-
if (strtolower($type) == 'x-accel-redirect') {
203+
if (strtolower($type) === 'x-accel-redirect') {
201204
// Do X-Accel-Mapping substitutions.
202205
// @link http://wiki.nginx.org/X-accel#X-Accel-Redirect
203206
foreach (explode(',', $request->headers->get('X-Accel-Mapping', '')) as $mapping) {
204207
$mapping = explode('=', $mapping, 2);
205208

206-
if (2 == count($mapping)) {
209+
if (2 === count($mapping)) {
207210
$pathPrefix = trim($mapping[0]);
208211
$location = trim($mapping[1]);
209212

210-
if (substr($path, 0, strlen($pathPrefix)) == $pathPrefix) {
213+
if (substr($path, 0, strlen($pathPrefix)) === $pathPrefix) {
211214
$path = $location.substr($path, strlen($pathPrefix));
212215
break;
213216
}
@@ -218,7 +221,7 @@ public function prepare(Request $request)
218221
$this->maxlen = 0;
219222
} elseif ($request->headers->has('Range')) {
220223
// Process the range headers.
221-
if (!$request->headers->has('If-Range') || $this->getEtag() == $request->headers->get('If-Range')) {
224+
if (!$request->headers->has('If-Range') || $this->getEtag() === $request->headers->get('If-Range')) {
222225
$range = $request->headers->get('Range');
223226
$fileSize = $this->file->getSize();
224227

@@ -253,17 +256,17 @@ public function prepare(Request $request)
253256

254257
/**
255258
* Sends the file.
259+
*
260+
* {@inheritdoc}
256261
*/
257262
public function sendContent()
258263
{
259264
if (!$this->isSuccessful()) {
260-
parent::sendContent();
261-
262-
return;
265+
return parent::sendContent();
263266
}
264267

265268
if (0 === $this->maxlen) {
266-
return;
269+
return $this;
267270
}
268271

269272
$out = fopen('php://output', 'wb');
@@ -277,6 +280,8 @@ public function sendContent()
277280
if ($this->deleteFileAfterSend) {
278281
unlink($this->file->getPathname());
279282
}
283+
284+
return $this;
280285
}
281286

282287
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.