From 7232271a379396ca1d4b083af051262057003c41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= <michal@cihar.com>
Date: Mon, 27 Mar 2017 15:55:35 +0200
Subject: [PATCH 1/1] Truncate only long passwords
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This avoids problems with certain PHP versions returning false when
first parameter to substr is ''.

Signed-off-by: Michal Čihař <michal@cihar.com>
---
 libraries/common.inc.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/libraries/common.inc.php
+++ b/libraries/common.inc.php
@@ -739,7 +739,7 @@
                 . ' ' . $cfg['Server']['auth_type']
             );
         }
-        if (isset($_REQUEST['pma_password'])) {
+        if (isset($_REQUEST['pma_password']) && strlen($_REQUEST['pma_password']) > 256) {
             $_REQUEST['pma_password'] = substr($_REQUEST['pma_password'], 0, 256);
         }
         $fqnAuthClass = 'PMA\libraries\plugins\auth\\' . $auth_class;
