This repository has been archived by the owner on Jan 2, 2019. It is now read-only.
HTML Writer: Caching causes "Call to a member function detach() on a non-object" with blank sheets #193
Labels
Milestone
I've got a small script which loops over sheets in a workbook and writes each as HTML. If the writer encounters a blank sheet, and some form of cell caching is turned on (I generally use cache_in_memory_gzip), we get:
PHP Fatal error: Call to a member function detach() on a non-object in /home/dir/phpExcel/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php on line 47
Here's a sample script I use to trigger the error:
Workaround
If we loop over the workbook once before the loop doing the writing, check for blank sheets with getHighestColumn() and getHighestRow(), and doing $sheet->getCell() if we find A1 to be the highest, and then iterate the workbook again in a separate loop, this goes away, so we do have a workaround. And, in our case, it's nice to do the blank sheet check anyway, since don't want blank sheets coming out as HTML. But it'd be nice to do them in the same loop :)
Other info
Ubuntu 12.04
php 5.3.10-1ubuntu3.6 (cli)
The text was updated successfully, but these errors were encountered: