Skip to content

Handle null message in PaymentStatusResponse constructor#113

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

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>
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+

1 participant