SimpleSAML_Utilities::getLastError PHP Method

getLastError() public static method

Deprecation: This method will be removed in SSP 2.0. Please call error_get_last() directly.
public static getLastError ( )
    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'];
    }

Usage Example

Example #1
0
 /**
  * Get temp directory path.
  *
  * This function retrieves the path to a directory where
  * temporary files can be saved.
  *
  * @return string  Path to temp directory, without a trailing '/'.
  */
 public static function getTempDir()
 {
     $globalConfig = SimpleSAML_Configuration::getInstance();
     $tempDir = $globalConfig->getString('tempdir', '/tmp/simplesaml');
     while (substr($tempDir, -1) === '/') {
         $tempDir = substr($tempDir, 0, -1);
     }
     if (!is_dir($tempDir)) {
         $ret = mkdir($tempDir, 0700, TRUE);
         if (!$ret) {
             throw new SimpleSAML_Error_Exception('Error creating temp dir ' . var_export($tempDir, TRUE) . ': ' . SimpleSAML_Utilities::getLastError());
         }
     } elseif (function_exists('posix_getuid')) {
         /* Check that the owner of the temp diretory is the current user. */
         $stat = lstat($tempDir);
         if ($stat['uid'] !== posix_getuid()) {
             throw new SimpleSAML_Error_Exception('Temp directory (' . var_export($tempDir, TRUE) . ') not owned by current user.');
         }
     }
     return $tempDir;
 }
All Usage Examples Of SimpleSAML_Utilities::getLastError