cvs: pear /File_Archive/Archive Reader.php
| From: | Vincent Lascaux | Date: | Mon, 23 May 2005 11:37:47 +0000 |
| Subject: | cvs: pear /File_Archive/Archive Reader.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32049@lists.php.net to get a copy of this message | ||
vincentlascaux Mon May 23 07:37:47 2005 EDT
Modified files:
/pear/File_Archive/Archive Reader.php
Log:
Close the reader and the writer (if autoclose on) even if there is an error during file extraction
http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader.php?r1=1.18&r2=1.19&ty=u
Index: pear/File_Archive/Archive/Reader.php
diff -u pear/File_Archive/Archive/Reader.php:1.18 pear/File_Archive/Archive/Reader.php:1.19
--- pear/File_Archive/Archive/Reader.php:1.18 Sat May 14 20:13:20 2005
+++ pear/File_Archive/Archive/Reader.php Mon May 23 07:37:46 2005
@@ -27,7 +27,7 @@
* @author Vincent Lascaux <vincentlascaux@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.gnu.org/copyleft/lesser.html LGPL
- * @version CVS: $Id: Reader.php,v 1.18 2005/05/15 00:13:20 vincentlascaux Exp $
+ * @version CVS: $Id: Reader.php,v 1.19 2005/05/23 11:37:46 vincentlascaux Exp $
* @link http://pear.php.net/package/File_Archive
*/
@@ -196,7 +196,7 @@
}
$filename = $this->getDataFilename();
- if ($filename !== NULL) {
+ if ($filename !== null) {
$error = $writer->writeFile($filename);
if (PEAR::isError($error)) {
return $error;
@@ -215,7 +215,7 @@
}
/**
- * Sends the whole reader to $writer
+ * Sends the whole reader to $writer and close the reader
*
* @param File_Archive_Writer $writer Where to write the files of the reader
* @param bool $autoClose If true, close $writer at the end of the function.
@@ -226,6 +226,7 @@
function extract(&$writer, $autoClose = true, $bufferSize = 102400)
{
if (PEAR::isError($writer)) {
+ $this->close();
return $writer;
}
@@ -236,11 +237,11 @@
$this->getMime()
);
if (PEAR::isError($error)) {
- return $error;
+ break;
}
$error = $this->sendData($writer, $bufferSize);
if (PEAR::isError($error)) {
- return $error;
+ break;
}
}
$this->close();