Skip to content

Appalling error handling!!!

I've just spent a couple of hours trying to work out why I kept getting a completely unhelpful and misleading message when trying to login via the portal.

Screenshot_from_2020-11-09_11-10-51

I ended up having to add loads of error_log() statements going right down to the vtlib/thirdparty/network/Request.php class.

I discovered that something wasn't working right around this test:

https://code.vtiger.com/vtiger/customerportal/blob/master/vtlib/thirdparty/network/Request.php#L784

If you look what happens after the elseif, you'll see this class just returns true.

https://code.vtiger.com/vtiger/customerportal/blob/master/vtlib/thirdparty/network/Request.php#L829

When I dumped the response just BEFORE this test in line 783, e.g.

error_log("response: " . print_r($this->_response,true));

I see in the _body the following:

    [_protocol] => HTTP/1.1
    [_code] => 403
    [_reason] => Forbidden
    [_headers] => Array
        (
            [server] => nginx/1.14.1
            [date] => Mon, 09 Nov 2020 11:08:25 GMT
            [content-type] => text/html
            [transfer-encoding] => chunked
            [connection] => close
            [vary] => Accept-Encoding
            [x-frame-options] => SAMEORIGIN
            [x-content-type-options] => nosniff
            [x-xss-protection] => 1; mode=block
            [content-encoding] => gzip
        )

    [_cookies] => 
    [_body] => <html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.14.1</center>
</body>
</html>

I can now go back to my customer and tell them their server is rejecting the call but why on earth is this information NOT more easily available? It was a total waste of my time trying to find this out!!!