fusionauth-php-client
fusionauth-php-client copied to clipboard
Cut 'empty' params in request (JSONBody)
I'm trying to do something like this:
$request = [ 'loginId' => $hostData->getUser()->getUsername(), 'sendForgotPasswordEmail' => false ]; $response = $this->client->forgotPassword($request);
but library remove params sendForgotPasswordEmail. I found something like this in code (JSONBodyHandler:427)
$this->body = json_encode(array_filter($bodyObject));
function array_filter without callback remove all empty records from array. In my case remove sendForgotPasswordEmail but it is general problem with this function. It remove values with false and 0.
Ah, that is an issue. Can you please try
$request = [ 'loginId' => $hostData->getUser()->getUsername(), 'sendForgotPasswordEmail' => "false" ];
and see if that gets you what you want?
yes, it is working, but not looks good. But solves problem, thanks.