a bug into package HTML_Table 1.5

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

a bug into package HTML_Table 1.5

Laurent Laville
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

$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

Laurent Laville

PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php