10000 bug #22304 Moved $this->setDate() before the deprecation handling. (m… · symfony/symfony@325e61d · GitHub
[go: up one dir, main page]

Skip to content

Commit 325e61d

Browse files
bug #22304 Moved $this->setDate() before the deprecation handling. (mpdonadio)
This PR was squashed before being merged into the 3.2 branch (closes #22304). Discussion ---------- Moved $this->setDate() before the deprecation handling. | Q | A | ------------- | --- | Branch? | 3.2 <!-- see comment below --> | Bug fix? | yes | New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no? | Deprecations? | no <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> <!-- - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. - Please fill in this template according to the PR you're about to submit. - Replace this comment by a description of what your PR is solving. --> #22036 merged the patch into the wrong place; the `$this->setDate()` happens after the deprecation handling, so it does not always get called. See also https://www.drupal.org/node/2712647?page=1#comment-12025349 Commits ------- b6df4e7 Moved ->setDate() before the deprecation handling.
2 parents db31e80 + b6df4e7 commit 325e61d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ public function __construct($content = '', $status = 200, $headers = array())
226226
$this->setStatusCode($status);
227227
$this->setProtocolVersion('1.0');
228228

229+
/* RFC2616 - 14.18 says all Responses need to have a Date */
230+
if (!$this->headers->has('Date')) {
231+
$this->setDate(\DateTime::createFromFormat('U', time()));
232+
}
233+
229234
// Deprecations
230235
$class = get_class($this);
231236
if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) {
@@ -242,11 +247,6 @@ public function __construct($content = '', $status = 200, $headers = array())
242247
@trigger_error(sprintf('Extending %s::%s() in %s is deprecated since version 3.2 and won\'t be supported anymore in 4.0 as it will be final.', __CLASS__, $method, $class), E_USER_DEPRECATED);
243248
}
244249
}
245-
246-
/* RFC2616 - 14.18 says all Responses need to have a Date */
247-
if (!$this->headers->has('Date')) {
248-
$this->setDate(\DateTime::createFromFormat('U', time()));
249-
}
250250
}
251251

252252
/**

0 commit comments

Comments
 (0)
0