diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php
index 9e36ad0cd57e6aba2dd0b338698407c7ebeba752..a671848245ed53fea6338965f94650aa3eb2cd69 100644
--- a/lib/private/AppConfig.php
+++ b/lib/private/AppConfig.php
@@ -348,10 +348,10 @@ class AppConfig implements IAppConfig {
 		$rows = $result->fetchAll();
 		foreach ($rows as $row) {
 			if (!isset($this->cache[$row['appid']])) {
-				$this->cache[$row['appid']] = [];
+				$this->cache[(string)$row['appid']] = [];
 			}
 
-			$this->cache[$row['appid']][$row['configkey']] = $row['configvalue'];
+			$this->cache[(string)$row['appid']][(string)$row['configkey']] = (string)$row['configvalue'];
 		}
 		$result->closeCursor();
 
diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php
index 40a99709bd5a45d6ea0258f7a64e3f238e034335..d2643d599f398aac44941fc70c4e573b95bf02ca 100644
--- a/tests/lib/AppConfigTest.php
+++ b/tests/lib/AppConfigTest.php
@@ -140,11 +140,11 @@ class AppConfigTest extends TestCase {
 	public function testGetApps() {
 		$config = new \OC\AppConfig(\OC::$server->getDatabaseConnection());
 
-		$this->assertEquals([
+		$this->assertEqualsCanonicalizing([
 			'anotherapp',
 			'someapp',
 			'testapp',
-			'123456',
+			123456,
 		], $config->getApps());
 	}
 
@@ -152,7 +152,7 @@ class AppConfigTest extends TestCase {
 		$config = new \OC\AppConfig(\OC::$server->getDatabaseConnection());
 
 		$keys = $config->getKeys('testapp');
-		$this->assertEquals([
+		$this->assertEqualsCanonicalizing([
 			'deletethis',
 			'depends_on',
 			'enabled',