From 985bdd11abce22f2d01b9ce707b0a1e647b9d31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 28 Dec 2015 11:25:40 +0100 Subject: [PATCH] Check whether iconv works before using it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On some systems iconv is installed, but is missing encoding definitions, what leads to runtime errors when trying to use it. By testing this we start using it only if it's properly working. Fixes #11787 Signed-off-by: Michal Čihař --- ChangeLog | 1 + libraries/charset_conversion.lib.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d6a08b1a05..c4e8968ead 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ phpMyAdmin - ChangeLog - issue #11784 Properly handle errors in upacking zip archive - issue #11785 Set PHP's internal encoding to UTF-8 - issue #11786 Fixed Kanji encoding in some specific cases +- issue #11787 Check whether iconv works before using it 4.5.3.1 (2015-12-25) - issue #11774 Undefined offset 2 diff --git a/libraries/charset_conversion.lib.php b/libraries/charset_conversion.lib.php index e3dd9a40ab..5d2e076a1b 100644 --- a/libraries/charset_conversion.lib.php +++ b/libraries/charset_conversion.lib.php @@ -41,7 +41,13 @@ if ($GLOBALS['cfg']['RecodingEngine'] == 'iconv') { PMA_warnMissingExtension('mbstring'); } } elseif ($GLOBALS['cfg']['RecodingEngine'] == 'auto') { - if (@function_exists('iconv')) { + /* + * We also need to verify iconv works, see + * https://github.com/phpmyadmin/phpmyadmin/issues/11787/ + * and + * https://bugs.php.net/bug.php?id=44096 + */ + if (@function_exists('iconv') && @iconv_strlen('', 'cp1250') !== false) { $PMA_recoding_engine = PMA_getIconvRecodingEngine(); } elseif (@function_exists('recode_string')) { $PMA_recoding_engine = PMA_CHARSET_RECODE;