Bug #17572 Temporary files are not removed
git-svn-id: https://svn.php.net/repository/pear/packages/Spreadsheet_Excel_Writer/trunk@320822 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
ad79fa75f3
commit
6f5b44cd6b
|
|
@ -90,6 +90,12 @@ class Spreadsheet_Excel_Writer_BIFFwriter extends PEAR
|
||||||
*/
|
*/
|
||||||
var $_tmp_dir;
|
var $_tmp_dir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The temporary file for storing the OLE file
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
var $_tmp_file;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -464,6 +464,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
|
||||||
$this->_dv = array();
|
$this->_dv = array();
|
||||||
|
|
||||||
$this->_tmp_dir = $tmp_dir;
|
$this->_tmp_dir = $tmp_dir;
|
||||||
|
$this->_tmp_file = '';
|
||||||
|
|
||||||
$this->_initialize();
|
$this->_initialize();
|
||||||
}
|
}
|
||||||
|
|
@ -493,8 +494,8 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
|
||||||
$fh = tmpfile();
|
$fh = tmpfile();
|
||||||
} else {
|
} else {
|
||||||
// For people with open base dir restriction
|
// For people with open base dir restriction
|
||||||
$tmpfilename = tempnam($this->_tmp_dir, "Spreadsheet_Excel_Writer");
|
$this->_tmp_file = tempnam($this->_tmp_dir, "Spreadsheet_Excel_Writer");
|
||||||
$fh = @fopen($tmpfilename, "w+b");
|
$fh = @fopen($this->_tmp_file, "w+b");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fh === false) {
|
if ($fh === false) {
|
||||||
|
|
@ -625,6 +626,16 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
|
||||||
$this->_storeDataValidity();
|
$this->_storeDataValidity();
|
||||||
}*/
|
}*/
|
||||||
$this->_storeEof();
|
$this->_storeEof();
|
||||||
|
|
||||||
|
if ( $this->_tmp_file != '' ) {
|
||||||
|
if ( $this->_filehandle ) {
|
||||||
|
fclose($this->_filehandle);
|
||||||
|
$this->_filehandle = '';
|
||||||
|
}
|
||||||
|
@unlink($this->_tmp_file);
|
||||||
|
$this->_tmp_file = '';
|
||||||
|
$this->_using_tmpfile = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue