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

MetaDataStorageHandlerSerialize: Better error reporting.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1552 44740490-163a-0410-bde0-09ae8108e29a
parent d2aecdec
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met ...@@ -39,7 +39,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met
/* Resolve this directory relative to the simpleSAMLphp directory (unless it is /* Resolve this directory relative to the simpleSAMLphp directory (unless it is
* an absolute path). * an absolute path).
*/ */
$this->directory = $globalConfig->resolvePath($this->directory) . '/'; $this->directory = $globalConfig->resolvePath($this->directory);
} }
...@@ -67,8 +67,9 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met ...@@ -67,8 +67,9 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met
$ret = array(); $ret = array();
$dh = opendir($this->directory); $dh = @opendir($this->directory);
if ($dh === FALSE) { if ($dh === FALSE) {
SimpleSAML_Logger::warning('Serialize metadata handler: Unable to open directory: ' . var_export($this->directory, TRUE));
return $ret; return $ret;
} }
...@@ -82,6 +83,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met ...@@ -82,6 +83,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met
$path = $this->directory . '/' . $entry; $path = $this->directory . '/' . $entry;
if (!is_dir($path)) { if (!is_dir($path)) {
SimpleSAML_Logger::warning('Serialize metadata handler: Metadata directory contained a file where only directories should exist: ' . var_export($path, TRUE));
continue; continue;
} }
...@@ -106,10 +108,15 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met ...@@ -106,10 +108,15 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met
$ret = array(); $ret = array();
$dir = $this->directory . '/' . rawurlencode($set); $dir = $this->directory . '/' . rawurlencode($set);
if(!is_dir($dir)) return $ret; if (!is_dir($dir)) {
$dh = opendir($dir); /* Probably some code asked for a metadata set which wasn't available. */
return $ret;
}
$dh = @opendir($dir);
if ($dh === FALSE) { if ($dh === FALSE) {
return NULL; SimpleSAML_Logger::warning('Serialize metadata handler: Unable to open directory: ' . var_export($dir, TRUE));
return $ret;
} }
$extLen = strlen(self::EXTENSION); $extLen = strlen(self::EXTENSION);
...@@ -156,14 +163,14 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met ...@@ -156,14 +163,14 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met
return NULL; return NULL;
} }
$data = file_get_contents($filePath); $data = @file_get_contents($filePath);
if ($data === FALSE) { if ($data === FALSE) {
SimpleSAML_Logger::warning('Error reading file ' . $filePath . SimpleSAML_Logger::warning('Error reading file ' . $filePath .
': ' . SimpleSAML_Utilities::getLastError()); ': ' . SimpleSAML_Utilities::getLastError());
return NULL; return NULL;
} }
$data = unserialize($data); $data = @unserialize($data);
if ($data === FALSE) { if ($data === FALSE) {
SimpleSAML_Logger::warning('Error deserializing file: ' . $filePath); SimpleSAML_Logger::warning('Error deserializing file: ' . $filePath);
return NULL; return NULL;
......
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