[patch] Spreadsheet_Excel_Writer open_basedir workaround fix
| From: | Sandro Berg | Date: | Sun, 31 Aug 2008 22:19:32 +0000 |
| Subject: | [patch] Spreadsheet_Excel_Writer open_basedir workaround fix | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-50689@lists.php.net to get a copy of this message | ||
Hello,
I ran into a problem using Spreadsheet_Excel_Writer on a server with
open_basedir restriction. In the current CVS version the _tmp_dir set by
setTempDir() won't get propagated from the workbook to the worksheets,
so Spreadsheet_Excel_Writer_Worksheet::_initialize() will try to use
tmpfile() and fail - writing the Warning into the generated Excel file.
The appended patch will:
- add a parameter $tmp_dir to the constructor of
Spreadsheet_Excel_Writer_Worksheet
- make the Spreadsheet_Excel_Writer_Workbook::addWorksheet() factory
pass the value of $this->_tmp_dir to the
Spreadsheet_Excel_Writer_Worksheet constructor
As Spreadsheet_Excel_Writer_Worksheet::_initialize() is called directly
from the contructor, this cannot be set later.
Spreadsheet_Excel_Writer_Worksheet is private, so the public API does
not change.
I do not claim copyright for this small fix, use as you see fit.
Feedback appreciated.
Regards,
Sandro Berg
Attachment: [text/x-patch]
Attachment: [text/x-patch]