Home » File Formats » File_Archive » Bug #10247
unnecessary calls to die()
Details
| Submitted | 2007-03-02 19:22 UTC |
|---|---|
| From | mkirk at cs dot umn dot edu |
| Assigned | pfischer |
| Status | Closed |
| Package | File_Archive |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2007-03-02 19:22 UTC] mkirk at cs dot umn dot edu
Description:
------------
It seems reasonable that all calls to die could be replaced with PEAR::raiseError()
Specifically, I am handling the case when attempting to extract a gzipped file as a tar-gzip. I encounter the line
die('Checksum error on entry '.$this->currentFilename);
The script shouldn't just halt, but return a useful error.
There are calls to die on line 205 in Archive/Reader/Tar.php and on line 70 in Archive/Reader/Concat.php
Test script:
---------------
//since uploaded files are given a random name
//without a useful extension, we can't extract from
//an uploaded archive.
$naive_reader = File_Archive::readUploadedFile('submitted_file');
//re-read the file reader with a specified extension
$archive = File_Archive::readArchive( $file_extension='tgz' , $naive_reader );
$dir_writer = File_Archive::appender($dir = 'submissions');
$error = File_Archive::extract( $archive , $dir_writer);
if( PEAR::isError( $error) )
{
echo "there was an error detected, couldnt extract";
}
else
{
echo "archive was extracted";
}
Expected result:
----------------
echo either "there was an error detected, couldnt extract"
or echo "archive was extracted"
Actual result:
--------------
this call to die from line 205 in Archive/Reader/Tar.php
die('Checksum error on entry '.$this->currentFilename);