README's Laravel/Symfony request examples pass header value arrays; verifyAppHomeReq and verifyWebhookReq throw TypeError
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- php
調査の方向性
Read Headers::normalize() and the verifier paths in src/Internal/Verify/AppHomeReq.php and src/Internal/Verify/BodyHmacInHeader.php; compare their expected header values with the arrays returned by Laravel and Symfony. Check how AdminUIExt, PosUIExt, and NonExchangeableIdToken use Authorization headers. Reproduce both reported TypeErrors, then verify that array-valued headers are handled and scalar headers still produce the expected results.
索引モデルが issue の本文から書いたものです。
説明
The "Converting a request" section of the README shows Laravel and Symfony examples that build the request array with $request->headers->all(). Symfony's HeaderBag::all() (which Laravel's request uses too) returns ['name' => ['value', …]], one list of values per header. Headers::normalize() only lowercases the keys, so the verifiers receive arrays where they expect strings:
verifyAppHomeReqwith anAuthorization: Bearer …header (every App Bridgefetch()) throwsTypeError: strpos(): Argument #1 ($haystack) must be of type string, array givenatsrc/Internal/Verify/AppHomeReq.php:182.verifyWebhookReqwith a correctly signed webhook throwsTypeError: hash_equals(): Argument #2 ($user_string) must be of type string, array giveninsrc/Internal/Verify/BodyHmacInHeader.php.
The initial page request works because its ID token is in the query string, so an app that follows the README sees this on its first API call or its first webhook. AdminUIExt, PosUIExt and NonExchangeableIdToken read the Authorization header the same way.
Reproduction with the package alone, v1.0.2 on PHP 8.5 (the same code is on main as of 9 Oct 2026):
$app = new Shopify\App\ShopifyApp(
clientId: 'test-client-id',
clientSecret: 'test-client-secret-at-least-32-bytes-long',
);
$app->verifyAppHomeReq([
'method' => 'GET',
'headers' => ['authorization' => ['Bearer x.y.z']],
'url' => 'https://example.test/api/shop',
'body' => '',
], appHomePatchIdTokenPath: '/auth/patch-id-token');
// TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given
$body = '{"domain":"test-shop.myshopify.com"}';
$hmac = base64_encode(hash_hmac('sha256', $body, 'test-client-secret-at-least-32-bytes-long', true));
$app->verifyWebhookReq([
'method' => 'POST',
'headers' => ['x-shopify-hmac-sha256' => [$hmac], 'x-shopify-shop-domain' => ['test-shop.myshopify.com']],
'url' => 'https://example.test/api/webhooks',
'body' => $body,
]);
// TypeError: hash_equals(): Argument #2 ($user_string) must be of type string, array given
With string values both calls behave normally (invalid_id_token for the fake token, verified for the webhook).
Two possible fixes: change the README examples to join the values, e.g. array_map(fn ($v) => implode(', ', $v), $request->headers->all()); or have Headers::normalize() accept arrays and join them, which would also cover other frameworks that return value lists. Happy to open a PR for either.
- 主要言語
- PHP
- スター
- 62
- フォーク
- 5
- 平均マージ
- 4時間 39分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Shopify/shopify-app-php のほかの issue
-
devtools-gardener
難易度 3/5 半日 初心者へのやさしさ 25/100
Shopify/shopify-app-php#29 ·
-
devtools-gardener
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Shopify/shopify-app-php#25 · コメント 2 件 ·
Shopify/shopify-app-php の issue をすべて見る
似ている issue
-
Upgrade psalmオープンdependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
mailcow/mailcow-dockerized#7705 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
pantheon-systems/wp-saml-auth#523 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
librespeed/speedtest#880 ·