Skip to content

Commit 4f281a6

Browse files
committed
Check if the property exists before checking whether it's an int
Older nette/database (pre 3.2.4) used never return type for __get and in that case PHPStan returns "Call to function is_int() with never will always evaluate to true." I could require nette/database 3.2.4 or add this check, and I think the check makes a bit more sense.
1 parent 834bb4b commit 4f281a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MysqlSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function gc(int $max_lifetime): int|false
208208
// There is no subtraction on server 1 and one day (or one tenth of $maxLifeTime)
209209
// subtraction on server 2.
210210
$row = $this->explorer->query('SELECT @@server_id as `serverId`')->fetch();
211-
if ($row && is_int($row->serverId) && $row->serverId > 1 && $row->serverId < 10) {
211+
if ($row && isset($row->serverId) && is_int($row->serverId) && $row->serverId > 1 && $row->serverId < 10) {
212212
$maxTimestamp -= ($row->serverId - 1) * \max(86400, $max_lifetime / 10);
213213
}
214214

0 commit comments

Comments
 (0)