Skip to content

Handle null message in PaymentStatusResponse constructor - #113

Closed
SAY-5 wants to merge 1 commit into
comgate-payments:masterfrom
SAY-5:fix-payment-status-null-message
Closed

Handle null message in PaymentStatusResponse constructor#113
SAY-5 wants to merge 1 commit into
comgate-payments:masterfrom
SAY-5:fix-payment-status-null-message

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 18, 2026

Copy link
Copy Markdown

Fixes #112.

On PHP 8.4+ with strict types, setMessage(string $message) throws a TypeError when a payment status response has no message field, which happens on some successful status checks. PaymentStatusResponse::__construct read $parsedResponse['message'] directly, so a missing or null value was passed straight through.

Coalesce to an empty string before use, matching how the other fields in the constructor already handle absent keys. Added a unit test covering a status response without a message.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@SimonZanta

Copy link
Copy Markdown
Collaborator

Ai generated PR, which is kinda useless -> closing

@SimonZanta SimonZanta closed this Jul 21, 2026
@SimonZanta SimonZanta reopened this Jul 22, 2026
@SimonZanta SimonZanta closed this Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: PaymentStatusResponse::setMessage(): Argument #1 ($message) must be of type string, null given in PHP 8.4+

2 participants