Skip to content
Snippets Groups Projects
Commit cd813406 authored by Olav Morken's avatar Olav Morken
Browse files

Utilities - add function to get last error message.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@868 44740490-163a-0410-bde0-09ae8108e29a
parent a189bf93
No related branches found
No related tags found
No related merge requests found
...@@ -1365,6 +1365,30 @@ class SimpleSAML_Utilities { ...@@ -1365,6 +1365,30 @@ class SimpleSAML_Utilities {
return $secretSalt; return $secretSalt;
} }
/**
* Retrieve last error message.
*
* This function retrieves the last error message. If no error has occured,
* '[No error message found]' will be returned. If the required function isn't available,
* '[Cannot get error message]' will be returned.
*
* @return string Last error message.
*/
public static function getLastError() {
if (!function_exists('error_get_last')) {
return '[Cannot get error message]';
}
$error = error_get_last();
if ($error === NULL) {
return '[No error message found]';
}
return $error['message'];
}
} }
?> ?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment