- Latest bugfixes made to allows https without SSL verification (for our wildcard cert)
This commit is contained in:
		
							parent
							
								
									04b8078c54
								
							
						
					
					
						commit
						f8b018144b
					
				@ -1,9 +1,7 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Negundo\Client {
 | 
					namespace Negundo\Client {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    class Dump {
 | 
					    class Dump {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        public static /* array */ $instances = [];
 | 
					        public static /* array */ $instances = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # public /*string*/ $serverUrl = "http://dev.cslsj.qc.ca/debug/dump/report/%s";
 | 
					        # public /*string*/ $serverUrl = "http://dev.cslsj.qc.ca/debug/dump/report/%s";
 | 
				
			||||||
 | 
				
			|||||||
@ -28,7 +28,7 @@ abstract class Handler {
 | 
				
			|||||||
        $this->config = $config;
 | 
					        $this->config = $config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->callback = $callback;
 | 
					        $this->callback = $callback;
 | 
				
			||||||
        $this->transport = $transport ?: new Transport\Curl();
 | 
					        $this->transport = $transport ?? new Transport\Curl();
 | 
				
			||||||
        $this->exceptionHandler = new Util\ExceptionHandler($dataManipulator);
 | 
					        $this->exceptionHandler = new Util\ExceptionHandler($dataManipulator);
 | 
				
			||||||
        $this->registerHandlers();
 | 
					        $this->registerHandlers();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -41,6 +41,7 @@ abstract class Handler {
 | 
				
			|||||||
        
 | 
					        
 | 
				
			||||||
        $this->registerErrorHandler && set_error_handler(function(int $severity, string $message, string $file, int $line) {
 | 
					        $this->registerErrorHandler && set_error_handler(function(int $severity, string $message, string $file, int $line) {
 | 
				
			||||||
            if ( error_reporting() & $severity ) {
 | 
					            if ( error_reporting() & $severity ) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $this->pushData(new \ErrorException($message, 0, $severity, $file, $line));
 | 
					                $this->pushData(new \ErrorException($message, 0, $severity, $file, $line));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@ -55,7 +56,7 @@ abstract class Handler {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public function pushData(\Throwable $ex) : ? object
 | 
					    public function pushData(\Throwable $ex) : ? object
 | 
				
			||||||
    {   
 | 
					    {
 | 
				
			||||||
        // Make sure not to spam the server if an ErrorMessage or Exception was already sent (like inside a loop)
 | 
					        // Make sure not to spam the server if an ErrorMessage or Exception was already sent (like inside a loop)
 | 
				
			||||||
        $exceptionHash = $this->exceptionHandler->hash($ex);
 | 
					        $exceptionHash = $this->exceptionHandler->hash($ex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -38,6 +38,9 @@ class NegundoMiddleware extends Handler implements MiddlewareInterface {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function handleException(\Throwable $ex) : array 
 | 
					    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);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -20,6 +20,7 @@ class Curl implements TransportInterface {
 | 
				
			|||||||
        curl_setopt($ch, CURLOPT_POST, 1);
 | 
					        curl_setopt($ch, CURLOPT_POST, 1);
 | 
				
			||||||
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data, '', '&'));
 | 
					        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data, '', '&'));
 | 
				
			||||||
        curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->timeout * 200);
 | 
					        curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->timeout * 200);
 | 
				
			||||||
 | 
					        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ( ( false === curl_exec($ch) ) && $this->throwErrors ) {
 | 
					        if ( ( false === curl_exec($ch) ) && $this->throwErrors ) {
 | 
				
			||||||
            $errno = curl_errno($ch);
 | 
					            $errno = curl_errno($ch);
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,7 @@ class ExceptionHandler {
 | 
				
			|||||||
            'code' => $ex->getCode(),
 | 
					            'code' => $ex->getCode(),
 | 
				
			||||||
            'file' => $ex->getFile(),
 | 
					            'file' => $ex->getFile(),
 | 
				
			||||||
            'line' => $ex->getLine(),
 | 
					            'line' => $ex->getLine(),
 | 
				
			||||||
 | 
					            'type' => $ex::class,
 | 
				
			||||||
            'message' => $ex->getMessage(),
 | 
					            'message' => $ex->getMessage(),
 | 
				
			||||||
            'url' => ( ( 'on' === $serverData['HTTPS'] ) ? 'https' : 'http' ) . '://' . $serverData['HTTP_HOST'] . $serverData["REQUEST_URI"],
 | 
					            'url' => ( ( 'on' === $serverData['HTTPS'] ) ? 'https' : 'http' ) . '://' . $serverData['HTTP_HOST'] . $serverData["REQUEST_URI"],
 | 
				
			||||||
            'backtrace' => json_encode($ex->getTrace()),
 | 
					            'backtrace' => json_encode($ex->getTrace()),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user