aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMiquel Rodríguez Telep / Michael Rodríguez-Torrent <miquel@designunbound.co.uk>2013-03-26 21:49:32 +0000
committerMiquel Rodríguez Telep / Michael Rodríguez-Torrent <miquel@designunbound.co.uk>2013-03-26 21:49:32 +0000
commit93a6ed3dab8d54fa2c735381298bec2bbcdfde41 (patch)
tree38274c8fcdc72fe60f06115234782b6f9cbd6dbf /tests
parent53fd122b89ff14b056094fcbcbd294bb63687778 (diff)
downloadnextcloud-server-93a6ed3dab8d54fa2c735381298bec2bbcdfde41.tar.gz
nextcloud-server-93a6ed3dab8d54fa2c735381298bec2bbcdfde41.zip
Ensure instanceid contains a letter
instanceid is generated by uniqid() and then used as the session_name. Because session_name requires at least one letter and uniqid() does not guarantee to provide that, in the case that uniqid() generates a string of only digits, the user will be stuck in an infinite login loop because every request will generate a new PHP session.
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/util.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/lib/util.php b/tests/lib/util.php
index 1c9054264c9..1f253825920 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -54,4 +54,9 @@ class Test_Util extends PHPUnit_Framework_TestCase {
$this->assertEquals('no-reply@example.com', $email);
OC_Config::deleteKey('mail_domain');
}
+
+ function testGetInstanceIdGeneratesValidId() {
+ OC_Config::deleteKey('instanceid');
+ $this->assertStringStartsWith('oc', OC_Util::getInstanceId());
+ }
}