Closed matsubo closed 9 years ago
Thank you @matsubo for the bug reporting. But as I know we can't post boolean data. All data is treated as strings. So boolean data will be converted to strings before to send them via POST. http_build_query convert false to 0, true to 1. If we suppose another function which converts them to "true" and "false", how can guest that were boolean and not a simple strings? Do you have an idea?
What you can do is something like that:
$capture = (bool) $_POST['capture'];If your application is waiting for strings: "true" and "false", then you change your array to:
[ "amount" => 900 "currency" => "JPY" "card" => "tok_SMJhkoibbHr9CYsv2wwcZ1Ik" "capture" => $capture ? "true" : "false" ]
You can also use filters: http://php.net/manual/en/function.filter-var.php
So this is not a bug. This is an HTTP behavior.
Yes. I noticed there is no variable type on HTTP. I was confused with JSON response data. Thank you for your kindly reply.
I passed following data to post method.
However the value of
capture
is changed fromfalse
to0
.This is caused
http_build_query
inside of post method. https://github.com/php-mod/curl/blob/master/src/Curl/Curl.php#L60This case of scenario is missing in test cases.