nuovo / spreadsheet-reader

A PHP spreadsheet reader (Excel XLS and XLSX, OpenOffice ODS, and variously separated text files) with a singular goal of getting the data out, efficiently
http://www.nuovo.lv/
Other
674 stars 498 forks source link

Default options overwritten for TempDir #96

Open frankforte opened 9 years ago

frankforte commented 9 years ago

The construct checks for $Options['TempDir'] supplied by the user, otherwise it defaults to the system temp dir. It ignores the default value supplied when declaring the $Options property on line 10:

$this -> TempDir = isset($Options['TempDir']) && is_writable($Options['TempDir']) ?
            $Options['TempDir'] :
            sys_get_temp_dir();

Possible fix:

if(isset($Options['TempDir']) && is_writable($Options['TempDir']))
{
    $this -> TempDir = $Options['TempDir'];
}
elseif($this->Options['TempDir'] && is_writable($this->Options['TempDir']))
{
    $this -> TempDir = $this->Options['TempDir'];
}
else
{
    $this -> TempDir = sys_get_temp_dir();
}