Better error handling on invalid .tgz packages

This commit is contained in:
Tomas V.V.Cox 2003-08-05 13:51:33 +00:00
parent f98251f307
commit 38ad5ff8d7

View file

@ -676,9 +676,17 @@ class PEAR_Common extends PEAR
return $this->raiseError("could not open file \"$file\""); return $this->raiseError("could not open file \"$file\"");
} }
$tar = new Archive_Tar($file); $tar = new Archive_Tar($file);
if ($this->debug <= 1) {
$tar->pushErrorHandling(PEAR_ERROR_RETURN);
}
$content = $tar->listContent(); $content = $tar->listContent();
if ($this->debug <= 1) {
$tar->popErrorHandling();
}
if (!is_array($content)) { if (!is_array($content)) {
return $this->raiseError("could not get contents of package \"$file\""); $file = realpath($file);
return $this->raiseError("Could not get contents of package \"$file\"".
'. Invalid tgz file.');
} }
$xml = null; $xml = null;
foreach ($content as $file) { foreach ($content as $file) {