Skip to content

Commit fd4956b

Browse files
committed
#178 Error when specified env vars are missing
1 parent 0e435c1 commit fd4956b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes for Shopify
22

3+
## Unreleased
4+
5+
- Fixed a PHP error that could occur with missing environment variables. ([#178](https://github.com/craftcms/shopify/issues/178))
6+
37
## 6.0.5 - 2025-09-09
48

59
- Fixed a bug where Shopify data could be overwritten when syncing products. ([#177](https://github.com/craftcms/shopify/issues/177))

src/models/Settings.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function setApiVersion(string $apiVersion): void
140140
*/
141141
public function getApiVersion(bool $parse = true): string
142142
{
143-
return $parse ? App::parseEnv($this->_apiVersion) : $this->_apiVersion;
143+
return ($parse ? App::parseEnv($this->_apiVersion) : $this->_apiVersion) ?? '';
144144
}
145145

146146
/**
@@ -160,7 +160,7 @@ public function setApiKey(string $apiKey): void
160160
*/
161161
public function getApiKey(bool $parse = true): string
162162
{
163-
return $parse ? App::parseEnv($this->_apiKey) : $this->_apiKey;
163+
return ($parse ? App::parseEnv($this->_apiKey) : $this->_apiKey) ?? '';
164164
}
165165

166166
/**
@@ -180,7 +180,7 @@ public function setApiSecretKey(string $apiSecretKey): void
180180
*/
181181
public function getApiSecretKey(bool $parse = true): string
182182
{
183-
return $parse ? App::parseEnv($this->_apiSecretKey) : $this->_apiSecretKey;
183+
return ($parse ? App::parseEnv($this->_apiSecretKey) : $this->_apiSecretKey) ?? '';
184184
}
185185

186186
/**
@@ -200,7 +200,7 @@ public function setHostName(string $hostName): void
200200
*/
201201
public function getHostName(bool $parse = true): string
202202
{
203-
return $parse ? App::parseEnv($this->_hostName) : $this->_hostName;
203+
return ($parse ? App::parseEnv($this->_hostName) : $this->_hostName) ?? '';
204204
}
205205

206206
/**
@@ -220,7 +220,7 @@ public function setAccessToken(string $accessToken): void
220220
*/
221221
public function getAccessToken(bool $parse = true): string
222222
{
223-
return $parse ? App::parseEnv($this->_accessToken) : $this->_accessToken;
223+
return ($parse ? App::parseEnv($this->_accessToken) : $this->_accessToken) ?? '';
224224
}
225225

226226
/**

0 commit comments

Comments
 (0)