mailgun / mailgun-php

Mailgun's Official SDK for PHP
http://www.mailgun.com
MIT License
1.09k stars 314 forks source link

Better json_decode exception handling #883

Closed Pilskalns closed 9 months ago

Pilskalns commented 9 months ago

Wrap json_decode in proper handling for strict syntax checks.

Fixes #882

wintrue commented 9 months ago

There are still mistakes.

wintrue commented 9 months ago

string(102) "{"id":"20231201095056.bb2a8c9f645a8ef7@xxx.com.hk","message":"Queued. Thank you."} " ^ Mailgun\Exception\HydrationException {#122

message: "Error (4) when trying to json_decode response"

code: 0

file: "/var/www/server/shawprize/server/vendor/mailgun/mailgun-php/src/Hydrator/ModelHydrator.php"

line: 42

trace: { /var/www/server/shawprize/server/vendor/mailgun/mailgun-php/src/Hydrator/ModelHydrator.php:42 {} /var/www/server/shawprize/server/vendor/mailgun/mailgun-php/src/Api/HttpApi.php:79 {} /var/www/server/shawprize/server/vendor/mailgun/mailgun-php/src/Api/Message.php:77 {} /var/www/server/shawprize/server/app/common/service/ExtHelperService.php:131 { app\common\service\ExtHelperService::sendMail($address, $subject, $body) … › # Make the call to the client. › $result= $mgClient->messages()->send($domain, $params); ›