For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > May 2005 > a bug into package HTML_Table 1.5









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author a bug into package HTML_Table 1.5
Laurent Laville

2005-05-08, 8:56 pm

Hi all,

On my current project i've used recently the HTML_Table package to
generate an html table. All run fine until a play more with it !

I've tried a clone of pear manual and dicovered a problem when data cell
is equal to zero (integer). The zero was replaced by null string.

BTW: there is a typo error in pear manual example at
http://pear.php.net/manual/en/packa...table.intro.php

$table -> setHeaderContents(0, 1, "EMail");
should be written like that
$table -> setHeaderContents(0, 4, "EMail");



Have a look at URL: http://pear.laurent-laville.org/HTML_Table/

You'll see the visual result

To solve the bug, but i'm not sure it's the best solution could be to :
patch HTML_Table::toHtml() method around line 583 as

if (isset($this->_structure[$i][$j]["contents"])) {
if (is_int($this->_structure[$i][$j]["contents"])) {
$contents = strval($this->_structure[$i][$j]["contents"]);
} else {
$contents = $this->_structure[$i][$j]["contents"];
}
} else {
$contents = "";
}

Tell me what you think about it

regards
Laurent Laville
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com