Skip to content

Commit 9f9eb47

Browse files
Merge branch '5.4' into 6.0
* 5.4: CS fixes Bump Symfony version to 5.4.11 Update VERSION for 5.4.10 Update CHANGELOG for 5.4.10 Bump Symfony version to 4.4.44 Update VERSION for 4.4.43 Update CONTRIBUTORS for 4.4.43 Update CHANGELOG for 4.4.43
2 parents 47f2aa6 + 1d3d261 commit 9f9eb47

21 files changed

+46
-46
lines changed

File/UploadedFile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ public function move(string $directory, string $name = null): File
209209
*/
210210
public static function getMaxFilesize(): int|float
211211
{
212-
$sizePostMax = self::parseFilesize(ini_get('post_max_size'));
213-
$sizeUploadMax = self::parseFilesize(ini_get('upload_max_filesize'));
212+
$sizePostMax = self::parseFilesize(\ini_get('post_max_size'));
213+
$sizeUploadMax = self::parseFilesize(\ini_get('upload_max_filesize'));
214214

215215
return min($sizePostMax ?: \PHP_INT_MAX, $sizeUploadMax ?: \PHP_INT_MAX);
216216
}

InputBag.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ final class InputBag extends ParameterBag
2727
*/
2828
public function get(string $key, mixed $default = null): string|int|float|bool|null
2929
{
30-
if (null !== $default && !is_scalar($default) && !$default instanceof \Stringable) {
30+
if (null !== $default && !\is_scalar($default) && !$default instanceof \Stringable) {
3131
throw new \InvalidArgumentException(sprintf('Excepted a scalar value as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($default)));
3232
}
3333

3434
$value = parent::get($key, $this);
3535

36-
if (null !== $value && $this !== $value && !is_scalar($value)) {
36+
if (null !== $value && $this !== $value && !\is_scalar($value)) {
3737
throw new BadRequestException(sprintf('Input value "%s" contains a non-scalar value.', $key));
3838
}
3939

@@ -66,7 +66,7 @@ public function add(array $inputs = [])
6666
*/
6767
public function set(string $key, mixed $value)
6868
{
69-
if (null !== $value && !is_scalar($value) && !\is_array($value) && !$value instanceof \Stringable) {
69+
if (null !== $value && !\is_scalar($value) && !\is_array($value) && !$value instanceof \Stringable) {
7070
throw new \InvalidArgumentException(sprintf('Excepted a scalar, or an array as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($value)));
7171
}
7272

Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ public function overrideGlobals()
542542

543543
$request = ['g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE];
544544

545-
$requestOrder = ini_get('request_order') ?: ini_get('variables_order');
545+
$requestOrder = \ini_get('request_order') ?: \ini_get('variables_order');
546546
$requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp';
547547

548548
$_REQUEST = [[]];

Session/Storage/Handler/AbstractSessionHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
3131
public function open(string $savePath, string $sessionName): bool
3232
{
3333
$this->sessionName = $sessionName;
34-
if (!headers_sent() && !ini_get('session.cache_limiter') && '0' !== ini_get('session.cache_limiter')) {
35-
header(sprintf('Cache-Control: max-age=%d, private, must-revalidate', 60 * (int) ini_get('session.cache_expire')));
34+
if (!headers_sent() && !\ini_get('session.cache_limiter') && '0' !== \ini_get('session.cache_limiter')) {
35+
header(sprintf('Cache-Control: max-age=%d, private, must-revalidate', 60 * (int) \ini_get('session.cache_expire')));
3636
}
3737

3838
return true;
@@ -86,7 +86,7 @@ public function write(string $sessionId, string $data): bool
8686

8787
public function destroy(string $sessionId): bool
8888
{
89-
if (!headers_sent() && filter_var(ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOLEAN)) {
89+
if (!headers_sent() && filter_var(\ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOLEAN)) {
9090
if (!isset($this->sessionName)) {
9191
throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', static::class));
9292
}

Session/Storage/Handler/MemcachedSessionHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function doRead(string $sessionId): string
6969

7070
public function updateTimestamp(string $sessionId, string $data): bool
7171
{
72-
$this->memcached->touch($this->prefix.$sessionId, time() + (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')));
72+
$this->memcached->touch($this->prefix.$sessionId, time() + (int) ($this->ttl ?? \ini_get('session.gc_maxlifetime')));
7373

7474
return true;
7575
}
@@ -79,7 +79,7 @@ public function updateTimestamp(string $sessionId, string $data): bool
7979
*/
8080
protected function doWrite(string $sessionId, string $data): bool
8181
{
82-
return $this->memcached->set($this->prefix.$sessionId, $data, time() + (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')));
82+
return $this->memcached->set($this->prefix.$sessionId, $data, time() + (int) ($this->ttl ?? \ini_get('session.gc_maxlifetime')));
8383
}
8484

8585
/**

Session/Storage/Handler/MongoDbSessionHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function gc(int $maxlifetime): int|false
105105
*/
106106
protected function doWrite(string $sessionId, string $data): bool
107107
{
108-
$expiry = new UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
108+
$expiry = new UTCDateTime((time() + (int) \ini_get('session.gc_maxlifetime')) * 1000);
109109

110110
$fields = [
111111
$this->options['time_field'] => new UTCDateTime(),
@@ -124,7 +124,7 @@ protected function doWrite(string $sessionId, string $data): bool
124124

125125
public function updateTimestamp(string $sessionId, string $data): bool
126126
{
127-
$expiry = new UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
127+
$expiry = new UTCDateTime((time() + (int) \ini_get('session.gc_maxlifetime')) * 1000);
128128

129129
$this->getCollection()->updateOne(
130130
[$this->options['id_field'] => $sessionId],

Session/Storage/Handler/NativeFileSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class NativeFileSessionHandler extends \SessionHandler
3131
public function __construct(string $savePath = null)
3232
{
3333
if (null === $savePath) {
34-
$savePath = ini_get('session.save_path');
34+
$savePath = \ini_get('session.save_path');
3535
}
3636

3737
$baseDir = $savePath;

Session/Storage/Handler/PdoSessionHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ protected function doDestroy(string $sessionId): bool
286286
*/
287287
protected function doWrite(string $sessionId, string $data): bool
288288
{
289-
$maxlifetime = (int) ini_get('session.gc_maxlifetime');
289+
$maxlifetime = (int) \ini_get('session.gc_maxlifetime');
290290

291291
try {
292292
// We use a single MERGE SQL query when supported by the database.
@@ -329,7 +329,7 @@ protected function doWrite(string $sessionId, string $data): bool
329329

330330
public function updateTimestamp(string $sessionId, string $data): bool
331331
{
332-
$expiry = time() + (int) ini_get('session.gc_maxlifetime');
332+
$expiry = time() + (int) \ini_get('session.gc_maxlifetime');
333333

334334
try {
335335
$updateStmt = $this->pdo->prepare(
@@ -603,7 +603,7 @@ protected function doRead(string $sessionId): string
603603
throw new \RuntimeException('Failed to read session: INSERT reported a duplicate id but next SELECT did not return any data.');
604604
}
605605

606-
if (!filter_var(ini_get('session.use_strict_mode'), \FILTER_VALIDATE_BOOLEAN) && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) {
606+
if (!filter_var(\ini_get('session.use_strict_mode'), \FILTER_VALIDATE_BOOLEAN) && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) {
607607
// In strict mode, session fixation is not possible: new sessions always start with a unique
608608
// random id, so that concurrency is not possible and this code path can be skipped.
609609
// Exclusive-reading of non-existent rows does not block, so we need to do an insert to block
@@ -848,7 +848,7 @@ private function getMergeStatement(string $sessionId, string $data, int $maxlife
848848
protected function getConnection(): \PDO
849849
{
850850
if (!isset($this->pdo)) {
851-
$this->connect($this->dsn ?: ini_get('session.save_path'));
851+
$this->connect($this->dsn ?: \ini_get('session.save_path'));
852852
}
853853

854854
return $this->pdo;

Session/Storage/Handler/RedisSessionHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function doRead(string $sessionId): string
6666
*/
6767
protected function doWrite(string $sessionId, string $data): bool
6868
{
69-
$result = $this->redis->setEx($this->prefix.$sessionId, (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')), $data);
69+
$result = $this->redis->setEx($this->prefix.$sessionId, (int) ($this->ttl ?? \ini_get('session.gc_maxlifetime')), $data);
7070

7171
return $result && !$result instanceof ErrorInterface;
7272
}
@@ -109,6 +109,6 @@ public function gc(int $maxlifetime): int|false
109109

110110
public function updateTimestamp(string $sessionId, string $data): bool
111111
{
112-
return $this->redis->expire($this->prefix.$sessionId, (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')));
112+
return $this->redis->expire($this->prefix.$sessionId, (int) ($this->ttl ?? \ini_get('session.gc_maxlifetime')));
113113
}
114114
}

Session/Storage/MetadataBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,6 @@ private function stampCreated(int $lifetime = null): void
148148
{
149149
$timeStamp = time();
150150
$this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp;
151-
$this->meta[self::LIFETIME] = $lifetime ?? (int) ini_get('session.cookie_lifetime');
151+
$this->meta[self::LIFETIME] = $lifetime ?? (int) \ini_get('session.cookie_lifetime');
152152
}
153153
}

Session/Storage/NativeSessionStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function start(): bool
131131
throw new \RuntimeException('Failed to start the session: already started by PHP.');
132132
}
133133

134-
if (filter_var(ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) {
134+
if (filter_var(\ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) {
135135
throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
136136
}
137137

@@ -197,7 +197,7 @@ public function regenerate(bool $destroy = false, int $lifetime = null): bool
197197
return false;
198198
}
199199

200-
if (null !== $lifetime && $lifetime != ini_get('session.cookie_lifetime')) {
200+
if (null !== $lifetime && $lifetime != \ini_get('session.cookie_lifetime')) {
201201
$this->save();
202202
ini_set('session.cookie_lifetime', $lifetime);
203203
$this->start();

Session/Storage/Proxy/SessionHandlerProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(\SessionHandlerInterface $handler)
2222
{
2323
$this->handler = $handler;
2424
$this->wrapper = $handler instanceof \SessionHandler;
25-
$this->saveHandlerName = $this->wrapper ? ini_get('session.save_handler') : 'user';
25+
$this->saveHandlerName = $this->wrapper ? \ini_get('session.save_handler') : 'user';
2626
}
2727

2828
public function getHandler(): \SessionHandlerInterface

Tests/File/UploadedFileTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class UploadedFileTest extends TestCase
2727
{
2828
protected function setUp(): void
2929
{
30-
if (!ini_get('file_uploads')) {
30+
if (!\ini_get('file_uploads')) {
3131
$this->markTestSkipped('file_uploads is disabled in php.ini');
3232
}
3333
}
@@ -333,7 +333,7 @@ public function testGetMaxFilesize()
333333

334334
$this->assertGreaterThan(0, $size);
335335

336-
if (0 === (int) ini_get('post_max_size') && 0 === (int) ini_get('upload_max_filesize')) {
336+
if (0 === (int) \ini_get('post_max_size') && 0 === (int) \ini_get('upload_max_filesize')) {
337337
$this->assertSame(\PHP_INT_MAX, $size);
338338
}
339339
}

Tests/RequestTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,7 +2357,7 @@ public function testTrustedPrefix()
23572357
{
23582358
Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_TRAEFIK);
23592359

2360-
//test with index deployed under root
2360+
// test with index deployed under root
23612361
$request = Request::create('/method');
23622362
$request->server->set('REMOTE_ADDR', '1.1.1.1');
23632363
$request->headers->set('X-Forwarded-Prefix', '/myprefix');
@@ -2378,7 +2378,7 @@ public function testTrustedPrefixWithSubdir()
23782378
'PHP_SELF' => '/public/index.php',
23792379
];
23802380

2381-
//test with index file deployed in subdir, i.e. local dev server (insecure!!)
2381+
// test with index file deployed in subdir, i.e. local dev server (insecure!!)
23822382
$request = Request::create('/public/method', 'GET', [], [], [], $server);
23832383
$request->server->set('REMOTE_ADDR', '1.1.1.1');
23842384
$request->headers->set('X-Forwarded-Prefix', '/prefix');
@@ -2391,7 +2391,7 @@ public function testTrustedPrefixWithSubdir()
23912391

23922392
public function testTrustedPrefixEmpty()
23932393
{
2394-
//check that there is no error, if no prefix is provided
2394+
// check that there is no error, if no prefix is provided
23952395
Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_TRAEFIK);
23962396
$request = Request::create('/method');
23972397
$request->server->set('REMOTE_ADDR', '1.1.1.1');

Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function testUseSessionGcMaxLifetimeAsTimeToLive()
9696
$this->storage->write('id', 'data');
9797
$ttl = $this->redisClient->ttl(self::PREFIX.'id');
9898

99-
$this->assertLessThanOrEqual(ini_get('session.gc_maxlifetime'), $ttl);
99+
$this->assertLessThanOrEqual(\ini_get('session.gc_maxlifetime'), $ttl);
100100
$this->assertGreaterThanOrEqual(0, $ttl);
101101
}
102102

Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function testWrite()
121121
$this->assertEquals(['upsert' => true], $options);
122122

123123
$data = $updateData['$set'];
124-
$expectedExpiry = time() + (int) ini_get('session.gc_maxlifetime');
124+
$expectedExpiry = time() + (int) \ini_get('session.gc_maxlifetime');
125125
$this->assertInstanceOf(\MongoDB\BSON\Binary::class, $data[$this->options['data_field']]);
126126
$this->assertEquals('bar', $data[$this->options['data_field']]->getData());
127127
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $data[$this->options['time_field']]);

Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public function testConstruct()
2929
{
3030
new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler(sys_get_temp_dir()));
3131

32-
$this->assertEquals('user', ini_get('session.save_handler'));
32+
$this->assertEquals('user', \ini_get('session.save_handler'));
3333

34-
$this->assertEquals(sys_get_temp_dir(), ini_get('session.save_path'));
35-
$this->assertEquals('TESTING', ini_get('session.name'));
34+
$this->assertEquals(sys_get_temp_dir(), \ini_get('session.save_path'));
35+
$this->assertEquals('TESTING', \ini_get('session.name'));
3636
}
3737

3838
/**
@@ -41,7 +41,7 @@ public function testConstruct()
4141
public function testConstructSavePath($savePath, $expectedSavePath, $path)
4242
{
4343
new NativeFileSessionHandler($savePath);
44-
$this->assertEquals($expectedSavePath, ini_get('session.save_path'));
44+
$this->assertEquals($expectedSavePath, \ini_get('session.save_path'));
4545
$this->assertDirectoryExists(realpath($path));
4646

4747
rmdir($path);
@@ -66,9 +66,9 @@ public function testConstructException()
6666

6767
public function testConstructDefault()
6868
{
69-
$path = ini_get('session.save_path');
69+
$path = \ini_get('session.save_path');
7070
new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler());
7171

72-
$this->assertEquals($path, ini_get('session.save_path'));
72+
$this->assertEquals($path, \ini_get('session.save_path'));
7373
}
7474
}

Tests/Session/Storage/Handler/NullSessionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class NullSessionHandlerTest extends TestCase
2929
public function testSaveHandlers()
3030
{
3131
$this->getStorage();
32-
$this->assertEquals('user', ini_get('session.save_handler'));
32+
$this->assertEquals('user', \ini_get('session.save_handler'));
3333
}
3434

3535
public function testSession()

Tests/Session/Storage/Handler/PdoSessionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function testReadConvertsStreamToString()
147147

148148
public function testReadLockedConvertsStreamToString()
149149
{
150-
if (filter_var(ini_get('session.use_strict_mode'), \FILTER_VALIDATE_BOOLEAN)) {
150+
if (filter_var(\ini_get('session.use_strict_mode'), \FILTER_VALIDATE_BOOLEAN)) {
151151
$this->markTestSkipped('Strict mode needs no locking for new sessions.');
152152
}
153153

Tests/Session/Storage/Handler/SessionHandlerFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ public function testCreateFileHandler(string $connectionDSN, string $expectedPat
3434
$handler = SessionHandlerFactory::createHandler($connectionDSN);
3535

3636
$this->assertInstanceOf($expectedHandlerType, $handler);
37-
$this->assertEquals($expectedPath, ini_get('session.save_path'));
37+
$this->assertEquals($expectedPath, \ini_get('session.save_path'));
3838
}
3939

4040
public function provideConnectionDSN(): array
4141
{
4242
$base = sys_get_temp_dir();
4343

4444
return [
45-
'native file handler using save_path from php.ini' => ['connectionDSN' => 'file://', 'expectedPath' => ini_get('session.save_path'), 'expectedHandlerType' => StrictSessionHandler::class],
45+
'native file handler using save_path from php.ini' => ['connectionDSN' => 'file://', 'expectedPath' => \ini_get('session.save_path'), 'expectedHandlerType' => StrictSessionHandler::class],
4646
'native file handler using provided save_path' => ['connectionDSN' => 'file://'.$base.'/session/storage', 'expectedPath' => $base.'/session/storage', 'expectedHandlerType' => StrictSessionHandler::class],
4747
];
4848
}

Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function testRegenerateWithCustomLifetime()
130130
$storage->regenerate(false, $lifetime);
131131
$this->assertNotEquals($id, $storage->getId());
132132
$this->assertEquals(11, $storage->getBag('attributes')->get('legs'));
133-
$this->assertEquals($lifetime, ini_get('session.cookie_lifetime'));
133+
$this->assertEquals($lifetime, \ini_get('session.cookie_lifetime'));
134134
}
135135

136136
public function testSessionGlobalIsUpToDateAfterIdRegeneration()
@@ -156,15 +156,15 @@ public function testDefaultSessionCacheLimiter()
156156
$this->iniSet('session.cache_limiter', 'nocache');
157157

158158
new NativeSessionStorage();
159-
$this->assertEquals('', ini_get('session.cache_limiter'));
159+
$this->assertEquals('', \ini_get('session.cache_limiter'));
160160
}
161161

162162
public function testExplicitSessionCacheLimiter()
163163
{
164164
$this->iniSet('session.cache_limiter', 'nocache');
165165

166166
new NativeSessionStorage(['cache_limiter' => 'public']);
167-
$this->assertEquals('public', ini_get('session.cache_limiter'));
167+
$this->assertEquals('public', \ini_get('session.cache_limiter'));
168168
}
169169

170170
public function testCookieOptions()
@@ -198,8 +198,8 @@ public function testSessionOptions()
198198

199199
$this->getStorage($options);
200200

201-
$this->assertSame('a=href', ini_get('session.trans_sid_tags'));
202-
$this->assertSame('200', ini_get('session.cache_expire'));
201+
$this->assertSame('a=href', \ini_get('session.trans_sid_tags'));
202+
$this->assertSame('200', \ini_get('session.cache_expire'));
203203
}
204204

205205
public function testSetSaveHandler()

0 commit comments

Comments
 (0)