From b39fbb4d46bc079527330c6c81f3932e1b167a28 Mon Sep 17 00:00:00 2001 From: "J.M" Date: Sun, 28 Apr 2013 19:15:49 +0200 Subject: [PATCH] Fix bug #3885 display_binary_as_hex option causes unexpected behavior --- ChangeLog | 1 + libraries/DisplayResults.class.php | 48 ++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21eeedf081..89f8eb1c2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ phpMyAdmin - ChangeLog - bug #3891 [import] Server upload folder import file name missing in success message + rfe #1421 [auth] Add retry button on connection failure with config auth + rfe #1422 [interface] Provide feedback if no columns selected for multi-submit +- bug #3885 [browse] display_binary_as_hex option causes unexpected behavior 4.0.0.0 (not yet released) + Patch #3481047 for rfe #3480477 Insert as new row enhancement diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 073df10a46..7c32b68704 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -3771,11 +3771,17 @@ class PMA_DisplayResults ) { $wkbval = PMA_substr(bin2hex($column), 8); } else { - $wkbval = htmlspecialchars( - PMA_Util::replaceBinaryContents( - $column - ) - ); + // force hex display for PHP < 5.4, no ENT_SUBSTITUTE + if (PMA_PHP_INT_VERSION < 50400) { + $wkbval = bin2hex($column); + } else { + $wkbval = htmlspecialchars( + PMA_Util::replaceBinaryContents( + $column + ), + ENT_SUBSTITUTE + ); + } } if ((PMA_strlen($wkbval) > $GLOBALS['cfg']['LimitChars']) @@ -3899,11 +3905,17 @@ class PMA_DisplayResults ) { $column = bin2hex($column); } else { - $column = htmlspecialchars( - PMA_Util::replaceBinaryContents( - $column - ) - ); + // force hex display for PHP < 5.4, no ENT_SUBSTITUTE + if (PMA_PHP_INT_VERSION < 50400) { + $column = bin2hex($column); + } else { + $column = htmlspecialchars( + PMA_Util::replaceBinaryContents( + $column + ), + ENT_SUBSTITUTE + ); + } } } else { @@ -5429,11 +5441,17 @@ class PMA_DisplayResults && $_SESSION['tmp_user_values']['display_blob'] ) { // in this case, restart from the original $content - $result = htmlspecialchars( - PMA_Util::replaceBinaryContents( - $content - ) - ); + // force hex display for PHP < 5.4, no ENT_SUBSTITUTE + if (PMA_PHP_INT_VERSION < 50400) { + $result = bin2hex($content); + } else { + $result = htmlspecialchars( + PMA_Util::replaceBinaryContents( + $content + ), + ENT_SUBSTITUTE + ); + } } /* Create link to download */