Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.8.4

Request #4988 addRow don't work with incomplete array
Submitted: 2005-08-03 15:41 UTC
From: albsala at gmail dot com Assigned: wiesemann
Status: Closed Package: HTML_Table
PHP Version: 4.3.11 OS: GNU/Linux
Roadmaps: (Not assigned)    
Subscription  


 [2005-08-03 15:41 UTC] albsala at gmail dot com
Description: ------------ If you add an array without all column numbers as a new row, addRow don't work as it should be. //This code: $row = array(1 => "Cell1", 2 => "Cell2", 5 => "Cell5"); $table->addRow($row); //only insert cell 1 and 2. Test script: --------------- //Lines 349-355 (addRow method): for ($counter = 0; $counter < count($contents); $counter++) { if ($type == 'TD') { $this->setCellContents($row, $counter, $contents[$counter]); } elseif ($type == 'TH') { $this->setHeaderContents($row, $counter, $contents[$counter]); } } //should be: foreach ($contents as $col => $content) { if ($type == 'TD') { $this->setCellContents($row, $col, $content); } elseif ($type == 'TH') { $this->setHeaderContents($row, $col, $content); } }

Comments

 [2005-10-20 13:51 UTC] post at markwiesemann dot de
I can reproduce this problem with current CVS version and have tested the suggested solution - it works as expected. Here is a patch for Table/Storage.php: www.markwiesemann.de/php/HTML_Table/Bug_4944.patch I can commit it myself, if you want.
 [2005-10-21 08:02 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!