X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fpear%2Fconsole_table%2FTable.php;h=dbfec73f1b9f87e3a47dc50b9b1acfd1f1047fa4;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=72d6bd8e23c1d8d60f76e0801f21f823532a7bd4;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/pear/console_table/Table.php b/vendor/pear/console_table/Table.php index 72d6bd8e2..dbfec73f1 100755 --- a/vendor/pear/console_table/Table.php +++ b/vendor/pear/console_table/Table.php @@ -647,14 +647,16 @@ class Console_Table $return = array(); for ($i = 0; $i < count($this->_data); $i++) { - for ($j = 0; $j < count($this->_data[$i]); $j++) { - if ($this->_data[$i] !== CONSOLE_TABLE_HORIZONTAL_RULE && - $this->_strlen($this->_data[$i][$j]) < - $this->_cell_lengths[$j]) { - $this->_data[$i][$j] = $this->_strpad($this->_data[$i][$j], - $this->_cell_lengths[$j], - ' ', - $this->_col_align[$j]); + if (is_array($this->_data[$i])) { + for ($j = 0; $j < count($this->_data[$i]); $j++) { + if ($this->_data[$i] !== CONSOLE_TABLE_HORIZONTAL_RULE && + $this->_strlen($this->_data[$i][$j]) < + $this->_cell_lengths[$j]) { + $this->_data[$i][$j] = $this->_strpad($this->_data[$i][$j], + $this->_cell_lengths[$j], + ' ', + $this->_col_align[$j]); + } } } @@ -786,7 +788,7 @@ class Console_Table function _updateRowsCols($rowdata = null) { // Update maximum columns. - $this->_max_cols = max($this->_max_cols, count($rowdata)); + $this->_max_cols = max($this->_max_cols, is_array($rowdata) ? count($rowdata) : 0); // Update maximum rows. ksort($this->_data); @@ -822,12 +824,14 @@ class Console_Table */ function _calculateCellLengths($row) { - for ($i = 0; $i < count($row); $i++) { - if (!isset($this->_cell_lengths[$i])) { - $this->_cell_lengths[$i] = 0; + if (is_array($row)) { + for ($i = 0; $i < count($row); $i++) { + if (!isset($this->_cell_lengths[$i])) { + $this->_cell_lengths[$i] = 0; + } + $this->_cell_lengths[$i] = max($this->_cell_lengths[$i], + $this->_strlen($row[$i])); } - $this->_cell_lengths[$i] = max($this->_cell_lengths[$i], - $this->_strlen($row[$i])); } }