Skip to content

Commit e36c8e5

Browse files
committed
Merge branch '4.4' into 5.3
* 4.4: Cast ini_get to an integer to match expected type
2 parents 8180363 + 09b3202 commit e36c8e5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Session/Storage/MetadataBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,6 @@ private function stampCreated(int $lifetime = null): void
161161
{
162162
$timeStamp = time();
163163
$this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp;
164-
$this->meta[self::LIFETIME] = $lifetime ?? ini_get('session.cookie_lifetime');
164+
$this->meta[self::LIFETIME] = $lifetime ?? (int) ini_get('session.cookie_lifetime');
165165
}
166166
}

Tests/Session/Storage/MetadataBagTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,14 @@ public function testDoesNotSkipLastUsedUpdate()
136136

137137
$this->assertEquals($timeStamp, $sessionMetadata[MetadataBag::UPDATED]);
138138
}
139+
140+
public function testLifetimeIsInt()
141+
{
142+
$sessionMetadata = [];
143+
144+
$bag = new MetadataBag();
145+
$bag->initialize($sessionMetadata);
146+
147+
$this->assertIsInt($bag->getLifetime());
148+
}
139149
}

0 commit comments

Comments
 (0)