Skip to content

Commit 7d95982

Browse files
authored
Merge pull request #293 from da-mask/issue_where_embedded_app_is_trying_to_pass_null_to_expire_in_setcookie
changed value of sessionExpiration to 0 instead of null
2 parents 0080c3c + 86b24cb commit 7d95982

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
- [#292](https://github.com/Shopify/shopify-api-php/pull/292) [Patch] Fix bug where null can be passed to param 3 of setcookie()
10+
811
## v5.9.0 - 2025-01-08
912
- [#393](https://github.com/Shopify/shopify-api-php/pull/393) [Minor] Add support for 2025-01 API version REST resources
1013
- [#367](https://github.com/Shopify/shopify-api-php/pull/367) [Patch] Allow uppercase characters in redirect URI

src/Auth/OAuth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public static function callback(array $cookies, array $query, ?callable $setCook
152152
);
153153
}
154154

155-
$sessionExpiration = ($session->getExpires() ? (int)$session->getExpires()->format('U') : null);
155+
$sessionExpiration = ($session->getExpires() ? (int)$session->getExpires()->format('U') : 0);
156156
$cookieSet = self::setSessionIdCookie(
157157
$setCookieFunction,
158158
$session->getId(),

tests/Auth/OAuthTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function testValidCallback($isOnline, $isEmbedded)
183183
} elseif ($isOnline) {
184184
$this->assertEquals($expectedSession->getExpires()->format('U'), $cookieExpiration);
185185
} else {
186-
$this->assertNull($cookieExpiration);
186+
$this->assertEquals(0, $cookieExpiration);
187187
}
188188
}
189189

0 commit comments

Comments
 (0)