cvs: pear /File_Archive/Archive/Reader Uncompress.php
| From: | Vincent Lascaux | Date: | Mon, 23 May 2005 13:03:59 +0000 |
| Subject: | cvs: pear /File_Archive/Archive/Reader Uncompress.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32056@lists.php.net to get a copy of this message | ||
vincentlascaux Mon May 23 09:03:59 2005 EDT
Modified files:
/pear/File_Archive/Archive/Reader Uncompress.php
Log:
+ YACC: Yet Another Critical Closing bug :)
http://cvs.php.net/diff.php/pear/File_Archive/Archive/Reader/Uncompress.php?r1=1.23&r2=1.24&ty=u
Index: pear/File_Archive/Archive/Reader/Uncompress.php
diff -u pear/File_Archive/Archive/Reader/Uncompress.php:1.23
pear/File_Archive/Archive/Reader/Uncompress.php:1.24
--- pear/File_Archive/Archive/Reader/Uncompress.php:1.23 Mon May 23 08:46:57 2005
+++ pear/File_Archive/Archive/Reader/Uncompress.php Mon May 23 09:03:59 2005
@@ -25,7 +25,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: Uncompress.php,v 1.23 2005/05/23 12:46:57 vincentlascaux Exp $
+ * @version CVS: $Id: Uncompress.php,v 1.24 2005/05/23 13:03:59 vincentlascaux Exp $
* @link http://pear.php.net/package/File_Archive
*/
@@ -44,13 +44,6 @@
var $readers = array();
/**
- * @var array of readers to close when closing this
- * This is filled by setBaseDir, with the readers that are needed to
- * reach the specified dir, but must not be stacked
- */
- var $toClose = array();
-
- /**
* @var File_Archive_Reader Reader from which all started (usefull to be
* able to close)
* @access private
@@ -66,24 +59,23 @@
var $uncompressionLevel;
/**
- * @var Int Depth of uncompression of the basicDir
+ * @var String Only files starting with $baseDir will be reported
* @access private
*/
- var $baseDirCompressionLevel = null;
+ var $baseDir = "";
/**
- * @var String Only files starting with $baseDir will be reported
+ * @var int Compression level required to go to reach the baseDir
+ * or null if it is currently being computed
* @access private
*/
- var $baseDir = "";
+ var $baseDirCompressionLevel = null;
/**
- * @var Bool True if the current file has not been reported
- * (used in setBaseDir to report an error if no file has been
- * found)
- * @access private
+ * @var boolean Flag set to indicate that the current file has not been
+ * displayed
*/
- var $currentFileDisplayed = true;
+ var $currentFileNotDisplayed = false;
function File_Archive_Reader_Uncompress(
&$innerReader, $uncompressionLevel = -1)
@@ -106,7 +98,7 @@
{
if ($this->uncompressionLevel >= 0 &&
$this->baseDirCompressionLevel !== null &&
- $this->uncompressionLevel >= count($this->readers)
+ count($this->readers) >= $this->uncompressionLevel +
$this->baseDirCompressionLevel
) {
return false;
}
@@ -146,8 +138,8 @@
*/
function next()
{
- if (!$this->currentFileDisplayed) {
- $this->currentFileDisplayed = true;
+ if ($this->currentFileNotDisplayed) {
+ $this->currentFileNotDisplayed = false;
return true;
}
do {
@@ -206,10 +198,9 @@
} else if (PEAR::isError($error)) {
return $error;
}
- $this->toClose = $this->readers;
$this->readers = array();
- $this->currentFileDisplayed = false;
+ $this->currentFileNotDisplayed = true;
return strlen($this->getFilename())>strlen($baseDir);
}
/**
@@ -251,18 +242,13 @@
for($i=0; $i<count($this->readers); ++$i) {
$this->readers[$i]->close();
}
- for($i=0; $i<count($this->toClose); ++$i) {
- $this->toClose[$i]->close();
- }
-
$this->readers = array();
$error = parent::close();
$this->source =& $this->startReader;
$this->source->close();
- $this->currentFileDisplayed = true;
- $this->setBaseDir($this->baseDir);
+ $this->currentFileNotDisplayed = false;
return $error;
}