Home » File Formats » Spreadsheet_Excel_Writer » Bug #4147
Invalid format file
Details
| Submitted | 2005-04-14 16:13 UTC |
|---|---|
| From | nicolasgury at free dot fr |
| Status | No Feedback |
| Package | Spreadsheet_Excel_Writer |
| PHP Version | 5.0.2 |
| OS | Linux Debian |
| Roadmaps | (Not assigned) |
Comments
[2005-04-14 16:13 UTC] nicolasgury at free dot fr
Description:
------------
With the 0.7 or 0.8 version, the generated .xls is sometimes corrupted, without logical reasons, even if the code has not been changed.
Reproduce code:
---------------
// Include PEAR::Spreadsheet_Excel_Writer
require_once "./Writer.php";
// Create an instance
$xls =& new Spreadsheet_Excel_Writer();
// Send HTTP headers to tell the browser what's coming
$xls->send("test.xls");
// Add a worksheet to the file, returning an object to add data to
$sheet =& $xls->addWorksheet('Binary Count');
// Write some numbers
for ( $i=0;$i<11;$i++ )
{
// Use PHP's decbin() function to convert integer to binary
$sheet->write($i,0,decbin($i));
}
// Finish the spreadsheet, dumping it to the browser
$xls->close();
Expected result:
----------------
A little sheet with a column of numbers
Actual result:
--------------
A corrupted format file.
[2005-04-18 19:04 UTC] dhunter at uta dot edu
It is broken with this setting:
magic_quotes_runtime = On
It works fine with this setting:
magic_quotes_runtime = Off
[2005-08-04 09:51 UTC] jacek dot drobiecki at mwi dot pl
also it may be broken with settings:
mbstring.func_overload = 7
or 3 or 6.
you should just add
mb_internal_encoding('ISO-8859-1');
before spreadsheet code.
[2005-11-08 13:43 UTC] xnoguer at php dot net
can't reproduce the bug