8000 feature #43378 [HttpFoundation] Deprecate upload_progress.* and url_r… · symfony/symfony@603ccac · GitHub
[go: up one dir, main page]

Skip to content

Commit 603ccac

Browse files
committed
feature #43378 [HttpFoundation] Deprecate upload_progress.* and url_rewriter.tags session options (Matthew Covey)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [HttpFoundation] Deprecate upload_progress.* and url_rewriter.tags session options | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | Fix #43284 | License | MIT Related to [issue #43284](#43284). Deprecate support for configuring session.upload_progress.* - these options are `PHP_INI_PERDIR` options and can not be configured at runtime via `ini_set`. Deprecate support for configuring `url_rewriter.tags` - as of PHP 7.1.0, this option is no longer used for session configuration and that setting is now `session.trans_sid_tags`. `url_rewriter.tags` is used only by `output_add_rewrite_var`. --- I wasn't sure about writing a test for this. I couldn't find any other places that deprecation notices were being tested. However the existing HttpFoundation test uses `url_rewriter.tags` and I can see the new deprecation notice when running `php ./phpunit src/Symfony/Component/HttpFoundation/` -- it may be appropriate to update that to use a new option. Commits ------- da02720 [HttpFoundation] Deprecate upload_progress.* and url_rewriter.tags session options
2 parents 8757fdd + da02720 commit 603ccac

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

UPGRADE-5.4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ HttpFoundation
4040
--------------
4141

4242
* Mark `Request::get()` internal, use explicit input sources instead
43+
* Deprecate `upload_progress.*` and `url_rewriter.tags` session options
4344

4445
Messenger
4546
---------

src/Symfony/Component/HttpFoundation/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add the `litespeed_finish_request` method to work with Litespeed
8+
* Deprecate `upload_progress.*` and `url_rewriter.tags` session options
89

910
5.3
1011
---

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,6 @@ class NativeSessionStorage implements SessionStorageInterface
9090
* use_cookies, "1"
9191
* use_only_cookies, "1"
9292
* use_trans_sid, "0"
93-
* upload_progress.enabled, "1"
94-
* upload_progress.cleanup, "1"
95-
* upload_progress.prefix, "upload_progress_"
96-
* upload_progress.name, "PHP_SESSION_UPLOAD_PROGRESS"
97-
* upload_progress.freq, "1%"
98-
* upload_progress.min-freq, "1"
99-
* url_rewriter.tags, "a=href,area=href,frame=src,form=,fieldset="
10093
* sid_length, "32"
10194
* sid_bits_per_character, "5"
10295
* trans_sid_hosts, $_SERVER['HTTP_HOST']
@@ -383,6 +376,13 @@ public function setOptions(array $options)
383376

384377
foreach ($options as $key => $value) {
385378
if (isset($validOptions[$key])) {
379+
if (str_starts_with($key, 'upload_progress.')) {
380+
trigger_deprecation('symfony/http-foundation', '5.4', 'Support for the "%s" session option is deprecated. The settings prefixed with "session.upload_progress." can not be changed at runtime.', $key);
381+
continue;
382+
}
383+
if ('url_rewriter.tags' === $key) {
384+
trigger_deprecation('symfony/http-foundation', '5.4', 'Support for the "%s" session option is deprecated. Use "trans_sid_tags" instead.', $key);
385+
}
386386
if ('cookie_samesite' === $key && \PHP_VERSION_ID < 70300) {
387387
// PHP < 7.3 does not support same_site cookies. We will emulate it in
388388
// the start() method instead.

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ public function testCookieOptions()
195195
public function testSessionOptions()
196196
{
197197
$options = [
198-
'url_rewriter.tags' => 'a=href',
198+
'trans_sid_tags' => 'a=href',
199199
'cache_expire' => '200',
200200
];
201201

202202
$this->getStorage($options);
203203

204-
$this->assertSame('a=href', ini_get('url_rewriter.tags'));
204+
$this->assertSame('a=href', ini_get('session.trans_sid_tags'));
205205
$this->assertSame('200', ini_get('session.cache_expire'));
206206
}
207207

0 commit comments

Comments
 (0)
0