Hi there,
I'm testing this library with the sample scripts in the readme file. Everything works as described except when I try to echo the response, in which case the script seems to run twice.
If I don't output the response it's fine but then I'd not have a way to check in my code whether the script was run successfully or not.
It makes no difference if I use sendRequest or sendAsyncRequest.
With the $reponse->getBody(), in my browser I can see 3 arrays, which is correct
But in the database I have twice as much rows
This is the constructor of my class:
`function __construct() {
$this->connection = new NetworkSocket(
'127.0.0.1', # Hostname
9000, # Port
5000, # Connect timeout in milliseconds (default: 5000)
5000 # Read/write timeout in milliseconds (default: 5000)
);
$this->client = new Client();
} This is the function that calls the script: function process(array $payload) {
If I remove the echo $response->getBody().' '; from my function the number of rows added to the database is 3 (correct) instead of 6 (wrong).
I'm using the latest version 3.1 with a php:8.0.8-fpm docker container, nginx latest and mysql latest.
Thank you for your work and hopefully your help with this.
Fabio.
UPDATE
I've ended up setting a header "Status" in my script async.php, and assign it to a property of my class, like this: $this->status=$response->getHeader('Status') I still have the correct number of records in my DB, so the issue seems to be only with echo ANYTHING (even echo $response->getHeader('Status') duplicates the number of calls to my script.
I wonder what am I doing wrong....
Hi there, I'm testing this library with the sample scripts in the readme file. Everything works as described except when I try to echo the response, in which case the script seems to run twice. If I don't output the response it's fine but then I'd not have a way to check in my code whether the script was run successfully or not. It makes no difference if I use sendRequest or sendAsyncRequest.
With the $reponse->getBody(), in my browser I can see 3 arrays, which is correct But in the database I have twice as much rows
This is the constructor of my class: `function __construct() {
}
This is the function that calls the script:
function process(array $payload) {}
And this is the script (async.php):
<?phpIf I remove the echo $response->getBody().'
'; from my function the number of rows added to the database is 3 (correct) instead of 6 (wrong). I'm using the latest version 3.1 with a php:8.0.8-fpm docker container, nginx latest and mysql latest.
Thank you for your work and hopefully your help with this. Fabio.
UPDATE I've ended up setting a header "Status" in my script async.php, and assign it to a property of my class, like this:
$this->status=$response->getHeader('Status')
I still have the correct number of records in my DB, so the issue seems to be only with echo ANYTHING (even echo $response->getHeader('Status') duplicates the number of calls to my script. I wonder what am I doing wrong....