SimpleSAML_Error_Error::show PHP Method

show() public method

This method displays a standard SimpleSAMLphp error page and exits.
public show ( )
    public function show()
    {
        $this->setHTTPCode();
        // log the error message
        $this->logError();
        $errorData = $this->saveError();
        $config = SimpleSAML_Configuration::getInstance();
        $data['showerrors'] = $config->getBoolean('showerrors', true);
        $data['error'] = $errorData;
        $data['errorCode'] = $this->errorCode;
        $data['parameters'] = $this->parameters;
        $data['module'] = $this->module;
        $data['dictTitle'] = $this->dictTitle;
        $data['dictDescr'] = $this->dictDescr;
        $data['includeTemplate'] = $this->includeTemplate;
        $data['clipboard.js'] = true;
        // check if there is a valid technical contact email address
        if ($config->getBoolean('errorreporting', true) && $config->getString('technicalcontact_email', '[email protected]') !== '[email protected]') {
            // enable error reporting
            $baseurl = \SimpleSAML\Utils\HTTP::getBaseURL();
            $data['errorReportAddress'] = $baseurl . 'errorreport.php';
        }
        $data['email'] = '';
        $session = SimpleSAML_Session::getSessionFromRequest();
        $authorities = $session->getAuthorities();
        foreach ($authorities as $authority) {
            $attributes = $session->getAuthData($authority, 'Attributes');
            if ($attributes !== null && array_key_exists('mail', $attributes) && count($attributes['mail']) > 0) {
                $data['email'] = $attributes['mail'][0];
                break;
                // enough, don't need to get all available mails, if more than one
            }
        }
        $show_function = $config->getArray('errors.show_function', null);
        if (isset($show_function)) {
            assert('is_callable($show_function)');
            call_user_func($show_function, $config, $data);
            assert('FALSE');
        } else {
            $t = new SimpleSAML_XHTML_Template($config, 'error.php', 'errors');
            $t->data = array_merge($t->data, $data);
            $t->show();
        }
        exit;
    }

Usage Example

Exemplo n.º 1
0
function SimpleSAML_exception_handler(Exception $exception)
{
    if ($exception instanceof SimpleSAML_Error_Error) {
        $exception->show();
    } else {
        $e = new SimpleSAML_Error_Error('UNHANDLEDEXCEPTION', $exception);
        $e->show();
    }
}
All Usage Examples Of SimpleSAML_Error_Error::show