diff --git a/ChangeLog b/ChangeLog index ec661c7278..d0c4bb5825 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,7 @@ phpMyAdmin - ChangeLog - issue #13234 Properly report not working sessions - issue #13256 Fixed password check on server replication - issue #13252 Fixed grid editing time column +- issue #13258 Fixed detection of Amazon RDS 4.7.0 (2017-03-28) - patch #12233 [Display] Improve message when renaming database to same name diff --git a/libraries/DatabaseInterface.php b/libraries/DatabaseInterface.php index 5d7341f049..4a67a79dc1 100644 --- a/libraries/DatabaseInterface.php +++ b/libraries/DatabaseInterface.php @@ -2767,8 +2767,8 @@ class DatabaseInterface return Util::cacheGet('is_amazon_rds'); } $sql = 'SELECT @@basedir'; - $result = $this->fetchResult($sql); - $rds = ($result[0] == '/rdsdbbin/mysql/'); + $result = $this->fetchValue($sql); + $rds = (substr($result, 0, 10) == '/rdsdbbin/'); Util::cacheSet('is_amazon_rds', $rds); return $rds; diff --git a/test/classes/DatabaseInterfaceTest.php b/test/classes/DatabaseInterfaceTest.php index 0f7f4223c2..99c4b7aadb 100644 --- a/test/classes/DatabaseInterfaceTest.php +++ b/test/classes/DatabaseInterfaceTest.php @@ -376,6 +376,43 @@ class DatabaseInterfaceTest extends PMATestCase ); } + /** + * Tests for DBI::isAmazonRds() method. + * + * @return void + * @test + * @dataProvider isAmazonRdsData + */ + public function atestIsAmazonRdsData($value, $expected) + { + Util::cacheUnset('is_amazon_rds'); + + $extension = new PMA\libraries\dbi\DBIDummy(); + $extension->setResult('SELECT @@basedir', $value); + + $dbi = new PMA\libraries\DatabaseInterface($extension); + + $this->assertEquals( + $expected, + $dbi->isAmazonRds() + ); + } + + /** + * Data provider for isAmazonRds() tests. + * + * @return array + */ + public function isAmazonRdsData() + { + return array( + array(array(array('/usr')), false), + array(array(array('E:/mysql')), false), + array(array(array('/rdsdbbin/mysql/')), true), + array(array(array('/rdsdbbin/mysql-5.7.18/')), true), + ); + } + /** * Test for version parsing *