- Latest bugfixes made to allows https without SSL verification (for our wildcard cert)

This commit is contained in:
Dave Mc Nicoll 2023-03-30 14:14:55 -04:00
parent 04b8078c54
commit f8b018144b
5 changed files with 9 additions and 5 deletions

View File

@ -1,9 +1,7 @@
<?php
namespace Negundo\Client {
class Dump {
public static /* array */ $instances = [];
# public /*string*/ $serverUrl = "http://dev.cslsj.qc.ca/debug/dump/report/%s";

View File

@ -28,7 +28,7 @@ abstract class Handler {
$this->config = $config;
$this->callback = $callback;
$this->transport = $transport ?: new Transport\Curl();
$this->transport = $transport ?? new Transport\Curl();
$this->exceptionHandler = new Util\ExceptionHandler($dataManipulator);
$this->registerHandlers();
}
@ -41,6 +41,7 @@ abstract class Handler {
$this->registerErrorHandler && set_error_handler(function(int $severity, string $message, string $file, int $line) {
if ( error_reporting() & $severity ) {
$this->pushData(new \ErrorException($message, 0, $severity, $file, $line));
}
});

View File

@ -38,6 +38,9 @@ class NegundoMiddleware extends Handler implements MiddlewareInterface {
public function handleException(\Throwable $ex) : array
{
return $this->exceptionHandler->extractExceptionData($ex, $this->request->getServerParams(), $this->request->getParsedBody());
$server = isset($this->request) ? $this->request->getServerParams() : $_SERVER;
$body = isset($this->request) ? $this->request->getParsedBody() : $_POST;
return $this->exceptionHandler->extractExceptionData($ex, $server, $body);
}
}

View File

@ -20,6 +20,7 @@ class Curl implements TransportInterface {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data, '', '&'));
curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->timeout * 200);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
if ( ( false === curl_exec($ch) ) && $this->throwErrors ) {
$errno = curl_errno($ch);

View File

@ -27,6 +27,7 @@ class ExceptionHandler {
'code' => $ex->getCode(),
'file' => $ex->getFile(),
'line' => $ex->getLine(),
'type' => $ex::class,
'message' => $ex->getMessage(),
'url' => ( ( 'on' === $serverData['HTTPS'] ) ? 'https' : 'http' ) . '://' . $serverData['HTTP_HOST'] . $serverData["REQUEST_URI"],
'backtrace' => json_encode($ex->getTrace()),