Skip to content

Commit 90f31e1

Browse files
committed
Better session support detection
1 parent 6295969 commit 90f31e1

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: true
1010
matrix:
11-
php: [8.1, 8.0]
11+
php: [8.2, 8.1, 8.0]
1212
dependency-version: [prefer-stable]
1313
os: [ubuntu-latest, windows-latest]
1414

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=8.0 <8.2",
15+
"php": ">=8.0 <8.3",
1616
"guzzlehttp/guzzle": "^7.3",
1717
"spatie/guzzle-rate-limiter-middleware": "^2.0"
1818
},

src/ConstantContact/Client.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,14 @@ private function session(string $key, ?string $value) : string
492492
return \call_user_func($this->sessionCallback, $key, $value);
493493
}
494494

495+
if (PHP_SESSION_ACTIVE !== \session_status())
496+
{
497+
throw new \PHPFUI\ConstantContact\Exception('session not started. Call session_start() or use \PHPFUI\ConstantContact\Client->setSessionCallback');
498+
}
499+
495500
if (null === $value)
496501
{
497-
$value = $_SESSION[$key];
502+
$value = $_SESSION[$key] ?? '';
498503
unset($_SESSION[$key]);
499504

500505
return $value;

0 commit comments

Comments
 (0)