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 #1166

Segmentation fault

Details

Submitted2004-04-09 00:25 UTC
Fromulyanov at comcast dot net
Assignedxnoguer
StatusClosed
PackageSpreadsheet_Excel_Writer
PHP Version4.3.4
OSGentoo Linux
Roadmaps(Not assigned)

Comments

[2004-04-09 00:25 UTC] ulyanov at comcast dot net

Description:
------------
This is very similar to bug #1149 (http://pear.php.net/bugs/bug.php?id=1149), I also get segmentation afult, except that I get it under different circumstances. It is hard to get it to always reproduce, since I've encountered it randomly depending on data I try to export to excel file.
Basically my script receives an array via POST and tries to write an excel row for each array entry. Depending on data in the array, sometimes it gives segemntation fault when I try to write a certain number into a cell It seems to always be close to last columns and close to last rows... but it's somewhat random... e.g. ignoring all values for certain rows works, ignoring all values for last column works... but ignoring only cells in last column on those same rows doesn't work.

The line inside the loop to store the number looks like this:

$worksheet->write($line_num, $col++, $value["p$i"], $format);

Reproduce code:
---------------
Ignoring all values for 2 rows works:
http://niesen.umassmed.edu/bug_test_yes.php
code:
http://niesen.umassmed.edu/bug_test_yes.phps

Ignoring values for all last column works: http://niesen.umassmed.edu/bug_test_yes_2.php
code:
http://niesen.umassmed.edu/bug_test_yes_2.phps

Ignoring only those 2 rows for only the last column gives segmentation fault:
http://niesen.umassmed.edu/bug_test_no_2.php
code:
http://niesen.umassmed.edu/bug_test_no_2.phps

Not ignoring anything gives segmentation fault in apache error_log:
http://niesen.umassmed.edu/bug_test_no.php
code:
http://niesen.umassmed.edu/bug_test_no.phps

data:
http://niesen.umassmed.edu/data.txt
view data array:
http://niesen.umassmed.edu/print_data.php
code:
http://niesen.umassmed.edu/print_data.phps

Expected result:
----------------
Works for all data

Actual result:
--------------
Works for only certain data, gives segmentation fault other times:

[Thu Apr 08 20:00:00 2004] [notice] child pid 539 exit signal Segmentation fault (11)
[Thu Apr 08 20:00:00 2004] [notice] child pid 538 exit signal Segmentation fault (11)

[2004-04-09 22:42 UTC] xnoguer at php dot net

Can you get a gdb trace for this segfault?

[2004-04-12 20:46 UTC] ulyanov at comcast dot net

Could you help me out a little, please?

I've tried running gdb, but wasn't successful. I have gentoo linux distribution which handles apache slightly different, than when installing from source code. I do not have httpd or core binaries. I do have apache2, apache2ctl, apache2logserverstatus and apache2splitlogfile.

apache2 -X or apache2ctrl -X don't seem to work the way I think httpd -X is supposed to. I could run gdb first, pointing it to /usr/sbin/apache2 and then did run -X, but then apache ran w/o the mod_php, so my php script displayed as text instead of being processed.

Do you by chance know what exactly the equivalent of httpd is and where it may be located?

Thanks!

[2004-04-14 23:25 UTC] xnoguer at php dot net

If I understand correctly you can't find the httpd executable? If that is the case, you can always check what running processes "ps -ef" shows. The apache deamon should be there somewhere.

An alternative would be to just execute your sample script from the command line (using php -f sample_script.php) so it writes the Excel file directly to the server. In that case you can run gdb with the php CLI executable.

If you need any more help, don't hesitate to ask.

[2004-04-23 16:36 UTC] ulyanov at comcast dot net

Actually, I do not have httpd executable, it's not that I can't find it. I have apache2 executable in its place. However, when I run it from gdb it fails to load mod_php so that the php script displays as text instead of being executed. I wondered if there was a way to load it into gdb with mod_php?

I was not able to reproduce this bug with php local client, it only seems to be buggy with apache and mod_php. Regular php prints out the file ok.

Another weird thing I noticed is that sometimes changing browser helps. For example a mac user was not able to save excel spreadsheet under IE for mac, but was able to under safari browser.

Could this be an apache bug somehow? I haven't really noticed this segmentation fault happening with anything but this package though.

Thanks!

[2004-05-24 21:02 UTC] ulyanov at comcast dot net

I just went to see if there was any progress on this bug, but when I clicked on buggy links, everything seemed to work just fine! I have done a few automatic updates to mod_php and apache since submitting the bug but I never upgraded the Spreadsheet package. So this was probably either apache or php bug. Unfortunately I haven't tested the bug after each upgrade, so I don't know which of the updates could've fixed it exactly. So this bug should probably be closed?

Thanks!