The branch, master has been updated via bd90d40defef2384145517c75cf1b185656327c9 (commit) via acdf39e95b355bc656409b66174afe6b7e0f39c6 (commit) from 4f55bfd945cf66f47382ebb7a3b9336e0e572c8e (commit)
- Log ----------------------------------------------------------------- commit bd90d40defef2384145517c75cf1b185656327c9 Merge: 4f55bfd945cf66f47382ebb7a3b9336e0e572c8e acdf39e95b355bc656409b66174afe6b7e0f39c6 Author: Marc Delisle marc@infomarc.info Date: Fri Apr 23 14:07:03 2010 -0400
bug #2974067 non-binary fields shown as hex
-----------------------------------------------------------------------
Summary of changes: ChangeLog | 1 + libraries/common.lib.php | 15 +++++++++++++-- libraries/display_tbl.lib.php | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 6b76217..8b1906e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -96,6 +96,7 @@ $Id$ designer, thanks to Sutharshan Balachandren. - bug #2983062, patch #2989408 [engines] Fix warnings when changing table engine to Maria, thanks to Madhura Jayaratne. +- bug #2974067 [display] non-binary fields shown as hex
3.3.2.0 (2010-04-13) - patch #2969449 [core] Name for MERGE engine varies depending on the diff --git a/libraries/common.lib.php b/libraries/common.lib.php index f8dcc60..76ebb06 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2600,8 +2600,19 @@ function PMA_printable_bit_value($value, $length) { }
/** - * Converts a BIT type default value - * for example, b'010' becomes 010 + * Verifies whether the value contains a non-printable character + * + * @uses preg_match() + * @param string $value + * @return boolean + */ +function PMA_contains_nonprintable_ascii($value) { + return preg_match('@[^[:print:]]@', $value); +} + +/** + * Converts a BIT type default value + * for example, b'010' becomes 010 * * @uses strtr() * @param string $bit_default_value diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index e99b97c..82ab6fb 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -1378,7 +1378,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) { if ($_SESSION['tmp_user_values']['display_binary']) { // user asked to see the real contents of BINARY // fields - if ($_SESSION['tmp_user_values']['display_binary_as_hex']) { + if ($_SESSION['tmp_user_values']['display_binary_as_hex'] && PMA_contains_nonprintable_ascii($row[$i])) { $row[$i] = bin2hex($row[$i]); } else {
hooks/post-receive