From d45e61efc596ae11ca4f0699a8a3efaaa0d10f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 15 Jun 2017 16:04:52 +0200 Subject: [PATCH 1/2] Avoid PHP errors with non existing configuration on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It sems that @ does notwork on fileperms there according to error reports. Fixes #13386 Signed-off-by: Michal Čihař --- ChangeLog | 1 + libraries/Config.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b63733c840..212a32f448 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ phpMyAdmin - ChangeLog - issue #13327 Fixed Incorrect NavigationTreeEnableExpansion default value in the documentation - issue #13008 Fixed export of database with a lot of tables - issue #13318 Improved performance when importing with enabled tracking +- issue #13386 Avoid PHP errors with non existing configuration on OS X 4.7.1 (2017-05-25) - issue #13132 Always execute tracking queries as controluser diff --git a/libraries/Config.php b/libraries/Config.php index 0c19bd70f2..a52d8fbe16 100644 --- a/libraries/Config.php +++ b/libraries/Config.php @@ -1137,7 +1137,7 @@ class Config public function checkPermissions() { // Check for permissions (on platforms that support it): - if ($this->get('CheckConfigurationPermissions')) { + if ($this->get('CheckConfigurationPermissions') && @file_exists($this->getSource())) { $perms = @fileperms($this->getSource()); if (!($perms === false) && ($perms & 2)) { // This check is normally done after loading configuration From 14f738c262296f4fabf45f9db47ea22adc3c6d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 15 Jun 2017 16:26:54 +0200 Subject: [PATCH 2/2] Show only supported charsets for conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #13388 Signed-off-by: Michal Čihař --- ChangeLog | 1 + libraries/Encoding.php | 18 +++++++++++++++++- libraries/display_export.lib.php | 2 +- libraries/display_import.lib.php | 2 +- test/classes/EncodingTest.php | 6 ++++++ 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 212a32f448..3054cfd51f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ phpMyAdmin - ChangeLog - issue #13008 Fixed export of database with a lot of tables - issue #13318 Improved performance when importing with enabled tracking - issue #13386 Avoid PHP errors with non existing configuration on OS X +- issue #13388 Show only supported charsets for conversion 4.7.1 (2017-05-25) - issue #13132 Always execute tracking queries as controluser diff --git a/libraries/Encoding.php b/libraries/Encoding.php index 700c40c324..8157e1e422 100644 --- a/libraries/Encoding.php +++ b/libraries/Encoding.php @@ -325,4 +325,20 @@ class Encoding . '
' . ''; } -} \ No newline at end of file + + public static function listEncodings() + { + if (is_null(self::$_engine)) { + self::initEngine(); + } + /* Most engines do not support listing */ + if (self::$_engine != self::ENGINE_MB) { + return $GLOBALS['cfg']['AvailableCharsets']; + } + + return array_intersect( + array_map('strtolower', mb_list_encodings()), + $GLOBALS['cfg']['AvailableCharsets'] + ); + } +} diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php index 36f2d77b15..c4a1614e41 100644 --- a/libraries/display_export.lib.php +++ b/libraries/display_export.lib.php @@ -639,7 +639,7 @@ function PMA_getHtmlForExportOptionsOutputCharset() $html = '
  • ' . "\n"; $html .= ''; - foreach ($cfg['AvailableCharsets'] as $temp_charset) { + foreach (Encoding::listEncodings() as $temp_charset) { $html .= '