diff --git a/ChangeLog b/ChangeLog index 92a1f8365e..7c7b0e156c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ phpMyAdmin - ChangeLog - bug #4661 Drag and drop file import always fails - bug #4651 don't open console with esc - bug #4664 select min() displays 1 row, but reports the table amount of rows returned +- bug #4666 Undefined indexes in table stucture print view of a view 4.3.3.0 (2014-12-21) - bug The "Recently used tables" setting should be with Nav panel diff --git a/libraries/tbl_printview.lib.php b/libraries/tbl_printview.lib.php index db4ae1fb6f..57b8daac9a 100644 --- a/libraries/tbl_printview.lib.php +++ b/libraries/tbl_printview.lib.php @@ -52,6 +52,7 @@ function PMA_getHtmlForPrintViewFooter() /** * return html for Print View Columns * + * @param bool $tbl_is_view whether table is a view * @param array $columns columns list * @param array $analyzed_sql analyzed sql * @param bool $have_rel have relation? @@ -63,7 +64,7 @@ function PMA_getHtmlForPrintViewFooter() * @return string */ function PMA_getHtmlForPrintViewColumns( - $columns, $analyzed_sql, $have_rel, + $tbl_is_view, $columns, $analyzed_sql, $have_rel, $res_rel, $db, $table, $cfgRelation ) { $html = ''; @@ -81,21 +82,24 @@ function PMA_getHtmlForPrintViewColumns( } $field_name = htmlspecialchars($row['Field']); - // here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as having the - // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe - // the latter. - /** - * @todo merge this logic with the one in tbl_structure.php - * or move it in a function similar to $GLOBALS['dbi']->getColumnsFull() - * but based on SHOW CREATE TABLE because information_schema - * cannot be trusted in this case (MySQL bug) - */ - $analyzed_for_field = $analyzed_sql[0]['create_table_fields'][$field_name]; - if (! empty($analyzed_for_field['type']) - && $analyzed_for_field['type'] == 'TIMESTAMP' - && $analyzed_for_field['timestamp_not_null'] - ) { - $row['Null'] = ''; + if (! $tbl_is_view) { + // here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as having + // the NULL attribute, but SHOW CREATE TABLE says the contrary. + // Believe the latter. + /** + * @todo merge this logic with the one in tbl_structure.php + * or move it in a function similar to $GLOBALS['dbi']->getColumnsFull() + * but based on SHOW CREATE TABLE because information_schema + * cannot be trusted in this case (MySQL bug) + */ + $analyzed_for_field + = $analyzed_sql[0]['create_table_fields'][$field_name]; + if (! empty($analyzed_for_field['type']) + && $analyzed_for_field['type'] == 'TIMESTAMP' + && $analyzed_for_field['timestamp_not_null'] + ) { + $row['Null'] = ''; + } } $html .= "\n"; @@ -484,7 +488,7 @@ function PMA_getHtmlForTableStructure( $html .= ''; $html .= '
'; $html .= PMA_getHtmlForPrintViewColumns( - $columns, $analyzed_sql, $have_rel, + $tbl_is_view, $columns, $analyzed_sql, $have_rel, $res_rel, $db, $table, $cfgRelation ); $html .= ''; diff --git a/test/libraries/PMA_tbl_printview_test.php b/test/libraries/PMA_tbl_printview_test.php index dce98d3a11..3db524559a 100644 --- a/test/libraries/PMA_tbl_printview_test.php +++ b/test/libraries/PMA_tbl_printview_test.php @@ -460,7 +460,7 @@ class PMA_TblPrintViewTest extends PHPUnit_Framework_TestCase $cfgRelation = array('mimework' => true); $html = PMA_getHtmlForPrintViewColumns( - $columns, $analyzed_sql, $have_rel, + false, $columns, $analyzed_sql, $have_rel, $res_rel, $db, $table, $cfgRelation );