Skip to content

Commit 48a0b59

Browse files
author
Tyler King
authored
Adds deprecation supports and fixes. (gnikyt#1207)
* Fixes deprecation notices for PHP8 * Adds deprecation logging support to tests being run
1 parent 1d5b351 commit 48a0b59

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/Http/Middleware/VerifyShopify.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ protected function getHmacFromRequest(Request $request): array
333333
DataSource::HEADER()->toNative() => $request->header('X-Shop-Signature'),
334334
// Headers: Referer
335335
DataSource::REFERER()->toNative() => function () use ($request): ?string {
336-
$url = parse_url($request->header('referer'), PHP_URL_QUERY);
337-
parse_str($url, $refererQueryParams);
336+
$url = parse_url($request->header('referer', ''), PHP_URL_QUERY);
337+
parse_str($url ?? '', $refererQueryParams);
338338
if (! $refererQueryParams || ! isset($refererQueryParams['hmac'])) {
339339
return null;
340340
}

src/Objects/Values/ShopDomain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function fromRequest(Request $request): ShopDomainValue
5353

5454
// Headers: Referer
5555
DataSource::REFERER()->toNative() => function () use ($request): ?string {
56-
$url = parse_url($request->header('referer'), PHP_URL_QUERY);
56+
$url = parse_url($request->header('referer', ''), PHP_URL_QUERY);
5757
if (! $url) {
5858
return null;
5959
}

src/Services/ApiHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,8 @@ private function getShopDomain(Session $session = null): NullableShopDomain
549549
},
550550
// Headers: Referer
551551
DataSource::REFERER()->toNative() => function (): ?string {
552-
$url = parse_url(Request::server('HTTP_REFERER'), PHP_URL_QUERY);
553-
parse_str($url, $refererQueryParams);
552+
$url = parse_url(Request::server('HTTP_REFERER', ''), PHP_URL_QUERY);
553+
parse_str($url ?? '', $refererQueryParams);
554554

555555
return Arr::get($refererQueryParams, 'shop');
556556
},

tests/TestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ protected function getEnvironmentSetUp($app): void
9696
'prefix' => '',
9797
]);
9898
$app['config']->set('auth.providers.users.model', UserStub::class);
99+
$app['config']->set('logging.deprecations', 'errorlog');
99100
}
100101

101102
protected function setupDatabase($app): void

0 commit comments

Comments
 (0)