Merge pull request #199 from box/check_valid_resource_on_close
Check file handle is valid before manipulating it
This commit is contained in:
commit
e9cd7a397e
@ -218,6 +218,10 @@ class Worksheet implements WorksheetInterface
|
|||||||
*/
|
*/
|
||||||
public function close()
|
public function close()
|
||||||
{
|
{
|
||||||
|
if (!is_resource($this->sheetFilePointer)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fclose($this->sheetFilePointer);
|
fclose($this->sheetFilePointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,10 @@ EOD;
|
|||||||
*/
|
*/
|
||||||
public function close()
|
public function close()
|
||||||
{
|
{
|
||||||
|
if (!is_resource($this->sharedStringsFilePointer)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fwrite($this->sharedStringsFilePointer, '</sst>');
|
fwrite($this->sharedStringsFilePointer, '</sst>');
|
||||||
|
|
||||||
// Replace the default strings count with the actual number of shared strings in the file header
|
// Replace the default strings count with the actual number of shared strings in the file header
|
||||||
|
@ -178,6 +178,10 @@ EOD;
|
|||||||
*/
|
*/
|
||||||
public function close()
|
public function close()
|
||||||
{
|
{
|
||||||
|
if (!is_resource($this->sheetFilePointer)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fwrite($this->sheetFilePointer, '</sheetData>');
|
fwrite($this->sheetFilePointer, '</sheetData>');
|
||||||
fwrite($this->sheetFilePointer, '</worksheet>');
|
fwrite($this->sheetFilePointer, '</worksheet>');
|
||||||
fclose($this->sheetFilePointer);
|
fclose($this->sheetFilePointer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user