Seems it's requiring json object instead of json array representation. not sure why! is something changed at sparkpost api level? In such case it's not wordpress 5.5 related!
I've used json_encode to convert to json object but as it returns string, I had to decode again. I've used php after long long time and no idea if there is a better way to convert to json obj.
need to verify if this fix works in older version of wordpress. if not, we've two options:
-- keep older format for older wordpress version (if it's version related)
-- change minimum required version for wordpress (which is what I did in this PR)
JSON_FORCE_OBJECT requires php 5.3+ (which should be fine but just need to make sure with php EOL guideline)
Please feel free to make any changes to this PR. If you need me to make other changes, I can aim that end of the day or tomorrow.
re: 2nd issue of
Warning: Invalid argument supplied for foreach() in /home/customer/www/fluxwebdesign7.be/public_html/customer/testdirk/wp-content/plugins/sparkpost/mailer.http.class.php on line 453
may be for some reason $this->createHeader is returning something unexpected! it needs more investigation! but this is just an warning not an actual error.
Seems it's requiring json object instead of json array representation. not sure why! is something changed at sparkpost api level? In such case it's not wordpress 5.5 related!
JSON_FORCE_OBJECT
requires php 5.3+ (which should be fine but just need to make sure with php EOL guideline)Please feel free to make any changes to this PR. If you need me to make other changes, I can aim that end of the day or tomorrow.
re: 2nd issue of
may be for some reason
$this->createHeader
is returning something unexpected! it needs more investigation! but this is just an warning not an actual error.