Report reason message get truncated
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start at the WebPush class around line 180, where the report reason calls getMessage(), and reproduce the failure with an invalid subscription. Compare that output with getResponse()->getBody()->getContents() and preserve the endpoint while ensuring the complete error message is available through getReason().
Written by the indexing model from the issue text.
Description
NOTE: Please test in a least two browsers (i.e. Chrome and Firefox). This
helps with diagnosing problems quicker.
Please confirm the following:
- I have read the README entirely
- I have verified in the issues that my problem hasn't already been resolved
Setup
- Operating System: Linux Mint
- PHP Version: 7.2
- web-push-php Version: 5.2.4
Please check that you have installed and enabled these PHP extensions :
- gmp
- mbstring
- curl
- openssl
Please select any browsers that you are experiencing problems with:
- Chrome
- Firefox
- Firefox for Mobile
- Opera for Android
- Samsung Internet Browser
- Other
Problem
When I use the wrong subscription for sending web push, $report->getReason() were truncated, like this:
Client error: `POST https://fcm.googleapis.com/fcm/send/eWp764UJNBM:APA91bHJVQXmxU9-Yr5j1VjxAZcJBWlvGRCRZjU4H7Z5_glrAc1O6R7o4w-UzTFdalqXEYZHJgxMjTrbXCCkAtKmaFqi_UnZ7MdPrbGJvcUyGNVTpGbYBf8EazF1TBVa3yHS1k5wR3qc` resulted in a `403 Forbidden` response:\nthe key in the authorization header does not correspond to the sender ID used to subscribe this user. Please ensure you (truncated...)\n
Expected
The error message should not truncated.
Features Used
- VAPID Support
- GCM API Key
- Sending with Payload
Example / Reproduce Case
Send notification with wrong subscription data with this format:
[
'subscription' => Subscription::create([ // this is the structure for the working draft from october 2018 (https://www.w3.org/TR/2018/WD-push-api-20181026/)
"endpoint" => "https://example.com/other/endpoint/of/another/vendor/abcdef...",
"keys" => [
'p256dh' => '(stringOf88Chars)',
'auth' => '(stringOf24Chars)'
],
]),
'payload' => '{msg:"Hello World!"}',
],
but with wrong subscription. Program should showing error message that truncated.
Other
When I search from internet, message gets truncated because of calling $reason->getMessage() at WebPush class line 180. When I change it to $reason->getResponse()->getBody()->getContents() I get complete message but without mentioning endpoint.
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 312
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from web-push-libs/web-push-php
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
web-push-libs/web-push-php#441 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
web-push-libs/web-push-php#430 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
web-push-libs/web-push-php#429 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
web-push-libs/web-push-php#412 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
web-push-libs/web-push-php#411 · 5 comments ·
All issues in web-push-libs/web-push-php
Similar issues
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/safe-publish#594 ·
-
needs-triage Platform(Default)
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
HttpClient
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
symfony/symfony-docs#23092 ·
-
sync-en
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
sync-en
Difficulty 1/5 Under an hour Newbie friendliness 95/100