Skip to content

Commit

Permalink
Merge pull request #293 from da-mask/issue_where_embedded_app_is_tryi…
Browse files Browse the repository at this point in the history
…ng_to_pass_null_to_expire_in_setcookie

changed value of sessionExpiration to 0 instead of null
  • Loading branch information
Arkham authored Jan 20, 2025
2 parents 0080c3c + 86b24cb commit 7d95982
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased
- [#292](https://github.com/Shopify/shopify-api-php/pull/292) [Patch] Fix bug where null can be passed to param 3 of setcookie()

## v5.9.0 - 2025-01-08
- [#393](https://github.com/Shopify/shopify-api-php/pull/393) [Minor] Add support for 2025-01 API version REST resources
- [#367](https://github.com/Shopify/shopify-api-php/pull/367) [Patch] Allow uppercase characters in redirect URI
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public static function callback(array $cookies, array $query, ?callable $setCook
);
}

$sessionExpiration = ($session->getExpires() ? (int)$session->getExpires()->format('U') : null);
$sessionExpiration = ($session->getExpires() ? (int)$session->getExpires()->format('U') : 0);
$cookieSet = self::setSessionIdCookie(
$setCookieFunction,
$session->getId(),
Expand Down
2 changes: 1 addition & 1 deletion tests/Auth/OAuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function testValidCallback($isOnline, $isEmbedded)
} elseif ($isOnline) {
$this->assertEquals($expectedSession->getExpires()->format('U'), $cookieExpiration);
} else {
$this->assertNull($cookieExpiration);
$this->assertEquals(0, $cookieExpiration);
}
}

Expand Down

0 comments on commit 7d95982

Please sign in to comment.