Browse Source

Fix #3: Add test on responses count when login, try with legacy=true when multiple responses

pull/4/head
Matthieu Racine 7 years ago
parent
commit
d5b9867bed
  1. 12
      src/Client.php

12
src/Client.php

@ -385,8 +385,18 @@ class Client implements Interfaces\ClientInterface
// Execute query and get response // Execute query and get response
$response = $this->write($query)->read(false); $response = $this->write($query)->read(false);
// if :
// - we have more than one response
// - response is '!done'
// => problem with legacy version, swap it and retry
// Only tested with ROS pre 6.43, will test with post 6.43 => this could make legacy parameter obsolete ?
if (count($response)>1 && $response[0] === '!done' && !$this->config('legacy'))
{
$this->_config->set('legacy', true);
return $this->login();
}
// Return true if we have only one line from server and this line is !done // Return true if we have only one line from server and this line is !done
return isset($response[0]) && $response[0] === '!done';
return (1 === count($response)) && isset($response[0]) && ($response[0] === '!done');
} }
/** /**

Loading…
Cancel
Save