PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » File Formats » Spreadsheet_Excel_Writer » Bug #4247

crash with big excel files

Details

Submitted2005-04-29 14:21 UTC
Fromgonzalo123 at gmail dot com
Assignedchief
StatusClosed
PackageSpreadsheet_Excel_Writer
PHP Version5.0.4
OSLinux Suse 9.2
Roadmaps(Not assigned)

Comments

[2005-04-29 14:21 UTC] gonzalo123 at gmail dot com

Description:
------------
When I try to generate very big files (more than 1.5Mb more or less) Spreadsheet_Excel_Writer allways return the same 2Mb(it looks like excel file but it is corrupt)

Reproduce code:
---------------
$workbook = new Spreadsheet_Excel_Writer();
for ($i;$i<=1000;$i++)
{
$worksheet =& $workbook->addWorksheet();
$worksheet->write(0, 0, "dummy");
for ($j;$j<=10000;$j++)
$worksheet->write($i, $j, "dummy");
}
$workbook->send('test.xls');
$workbook->close();

[2005-04-29 14:53 UTC] gonzalo123 at gmail dot com

It works with PHP4

[2005-04-29 16:47 UTC] gonzalo123 at gmail dot com

I have tried with the latest versions from CVS too

[2005-04-30 11:51 UTC] gonzalo123 at gmail dot com

yes only with the latest php5. Exactly the same code with PHP4 works. with PHP5 works if the output excel file is <1.5 (more or less) but if it is bigger the output file allways is 2M (even if it is bigger) this 2Mb file looks like one exel file but it is impossible to open it with oO or msExcel. I have check the tmp folder and it is ok

[2005-05-27 19:42 UTC] james at charity dot org

This bug is cross platform and does appear in PHP5 (4 seems fine). The bug only effects files that are sent directly to the web browser. Files that are generated to the file system, by specifying the file name, are fine.

PHP5 itself does not have a problem passing excel spreadsheets through using the same headers as this module does (blank script reading a file and printing it out after the appropriate headers). I haven't been able to locate the issue within Excel Writer yet.

[2006-02-21 11:40 UTC] chief at php dot net

Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP --
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PEAR.

Its a PHP 5.0.4 bug, not a Excel_Writer bug: http://bugs.php.net/bug.php?id=32553

Quick workaround: specify a file name in constructor. After closing workbook send it to user using while(echo fread(...))