I have 3 classes: server, client, service. used to implement a SOAP web service.
The service constructs an associative array, then passes it to the client which finally passes it to the server. And a response is sent back.
Relevant code:
service.php
<?php
include './client.php';
$id_array = array("country_code"=> "+36");
echo $client->getName($id_array);
?>
client.php
public function getName($id_array)
{
return $this->instance->__soapCall('getCountryName', $id_array);
}
and server.php
public function getCountryName($id_array)
{
$country_code = array();
$country_code = $id_array['country_code'];
//this return value to debug (not actual function)
return $country_code;
}
The problem occurs at: $country_code = $id_array['country_code'];
At which point $country_code is given the value +, instead of +36.
Why is that happening?
P.S. __soapCall passes the $id_array to the function getCountryName() in server.php
Also, everything works as intended if I use $country_code of length 1.
__soapCall()there is no way to see what happens to$id_array. The rest of the code does not do anything wrong with it.