You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #54590 [HttpFoundation] Remove unused code (minor) (smnandre)
This PR was merged into the 7.1 branch.
Discussion
----------
[HttpFoundation] Remove unused code (minor)
| Q | A
| ------------- | ---
| Branch? | 7.1
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Issues | Fix #...
| License | MIT
Remove two unused var declarations (both are declared/computed just after) (in green in the following code block)
```diff
// headers
foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
- $newValues = $values;
- $replace = false;
// As recommended by RFC 8297, PHP automatically copies headers from previous 103 responses, we need to deal with that if headers changed
$previousValues = $this->sentHeaders[$name] ?? null;
if ($previousValues === $values) {
// Header already sent in a previous response, it will be automatically copied in this response by PHP
continue;
}
+ $replace = 0 === strcasecmp($name, 'Content-Type');
if (null !== $previousValues && array_diff($previousValues, $values)) {
header_remove($name);
$previousValues = null;
}
+ $newValues = null === $previousValues ? $values : array_diff($values, $previousValues);
foreach ($newValues as $value) {
header($name.': '.$value, $replace, $this->statusCode);
}
```
Commits
-------
08841af1a15 [HttpFoundation] Remove unused code (minor)
0 commit comments