Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 47293 - PEAR-Spreadsheet_Excel_Writer crashes with 'wrong parameter count' error
Summary: PEAR-Spreadsheet_Excel_Writer crashes with 'wrong parameter count' error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-08 17:59 UTC by Dean
Modified: 2004-04-18 06:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dean 2004-04-08 17:59:25 UTC
PEAR-Spreadsheet_Excel_Writer crashes with the following error: 
Warning: Wrong parameter count for array_push() in /usr/lib/php/Spreadsheet/Excel/Writer/Workbook.php on line 1448

Notes:
o The problem is that the program is using an array_push where it wants to be using array_pop.
o This bug has been fixed in the latest release on pear.php.net (V1.7)

Reproducible: Always
Steps to Reproduce:
Save the following code as 'example.php' and run the command: php example.php

<?php
require_once 'Spreadsheet/Excel/Writer.php';

// We give the path to our file here
$workbook = new Spreadsheet_Excel_Writer('test.xls');
// Setup to use Excel 97 format
$workbook->setVersion(8);

// Create a long string.  Make sure it is greater than 255 characters...
//
$astring = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
$mystring = $astring.$astring.$astring.$astring.$astring.$string.$astring.$astring;

//Prepare the first sheet...
$mworksheet =& $workbook->addWorksheet('My Example');
$mworksheet->writeString(0, 0, 'Header 1');
$mworksheet->writeString(0, 1, 'Header 2');
$mworksheet->writeString(0, 2, 'Header 3');
$mworksheet->WriteString(0, 3, 'Header 4');
$mworksheet->setColumn(0,0, 50);
$mworksheet->setColumn(1,1, 20);
$mworksheet->setColumn(3,3, 50);

//Write to the spreadsheet
for ($row = 1; $row < 100; $row++)
{
	$mworksheet->writeString($row,0,$mystring);
	$mworksheet->writeURL($row,3,"http://www.dummy.org/".$mystring);
//
// Rotate the string, else it recognises that it has already saved it!
//
	$first = substr($mystring,0,1);
	$rest = substr($mystring,1);
	$mystring = $rest.$first;
}

// We still need to explicitly close the workbook
$workbook->close();
?>

Actual Results:  
Received the error:
Warning: Wrong parameter count for array_push() in
/usr/lib/php/Spreadsheet/Excel/Writer/Workbook.php on line 1448


Expected Results:  
Created and populated an Excel spreadsheet.
Comment 1 Tal Peer (RETIRED) gentoo-dev 2004-04-18 06:25:17 UTC
New version is now in portage (0.7), sync in half an hour or so to get it.