PHP_XLSXWriter
PHP_XLSXWriter copied to clipboard
Cannot instantiate XLSXWriter if the sys_get_temp_dir() is not writeable
affected version 0.39
Let's assume I want to instantiate XLSXWriter and then I want to change the tempDir.
$tempDir = ini_get('upload_tmp_dir');
$writer = new XLSXWriter();
$writer->setTempDir($tempDir);
...
The __construct() immediatly calls tempFilename()
According to that portion of code: https://github.com/mk-j/PHP_XLSXWriter/blob/5b77d3d4ccb88d21294ad5f5aaa0075979233256/xlsxwriter.class.php#L57-L70
the $this->tempdir is empty and $tempdir will always be equal to sys_get_temp_dir()
Now, if sys_get_temp_dir() is not writeable, the tempFilename() will always return an exception and you cannot instantiate the class.
Please remove that check from the constructor, since you cannot change the tempo path before instantiating the object.
thanks a lot for your work! Francesco