Fix errors when reporting errors

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2019-07-01 11:15:38 +02:00
parent 6451c1371f
commit b42685c63a
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
3 changed files with 6 additions and 6 deletions

View File

@ -55,7 +55,7 @@ if (isset($_POST['send_error_report'])
// report if and only if there were 'actual' errors. // report if and only if there were 'actual' errors.
if (count($reportData) > 0) { if (count($reportData) > 0) {
$server_response = $errorReport->send($reportData); $server_response = $errorReport->send($reportData);
if ($server_response === false) { if (! is_string($server_response)) {
$success = false; $success = false;
} else { } else {
$decoded_response = json_decode($server_response, true); $decoded_response = json_decode($server_response, true);

View File

@ -208,7 +208,7 @@ class ErrorReport
* *
* @param array $report the report info to be sent * @param array $report the report info to be sent
* *
* @return string the reply of the server * @return string|null|bool the reply of the server
*/ */
public function send(array $report) public function send(array $report)
{ {

View File

@ -63,7 +63,7 @@ class HttpRequest
* @param int $httpStatus HTTP response status code * @param int $httpStatus HTTP response status code
* @param bool $returnOnlyStatus If set to true, the method would only return response status * @param bool $returnOnlyStatus If set to true, the method would only return response status
* *
* @return mixed * @return string|null|bool
*/ */
private function response( private function response(
$response, $response,
@ -92,7 +92,7 @@ class HttpRequest
* @param string $header Header to be set for the HTTP request * @param string $header Header to be set for the HTTP request
* @param int $ssl SSL mode to use * @param int $ssl SSL mode to use
* *
* @return mixed * @return string|null|bool
*/ */
private function curl( private function curl(
$url, $url,
@ -192,7 +192,7 @@ class HttpRequest
* @param mixed $content Content to be sent with HTTP request * @param mixed $content Content to be sent with HTTP request
* @param string $header Header to be set for the HTTP request * @param string $header Header to be set for the HTTP request
* *
* @return mixed * @return string|null|bool
*/ */
private function fopen( private function fopen(
$url, $url,
@ -239,7 +239,7 @@ class HttpRequest
* @param mixed $content Content to be sent with HTTP request * @param mixed $content Content to be sent with HTTP request
* @param string $header Header to be set for the HTTP request * @param string $header Header to be set for the HTTP request
* *
* @return mixed * @return string|null|bool
*/ */
public function create( public function create(
$url, $url,