1
0
Fork 0

Merge pull request #1543 from Slamdunk/minor/mt-rand

Switch rand() to mt_rand()
pull/1544/merge
Jordi Boggiano 2013-01-30 02:50:42 -08:00
commit 3b2accfb58
6 changed files with 7 additions and 7 deletions

View File

@ -58,7 +58,7 @@ abstract class ArchiveDownloader extends FileDownloader
} else {
// Rename the content directory to avoid error when moving up
// a child folder with the same name
$temporaryDir = sys_get_temp_dir().'/'.md5(time().rand());
$temporaryDir = sys_get_temp_dir().'/'.md5(time().mt_rand());
$this->filesystem->rename($contentDir, $temporaryDir);
$contentDir = $temporaryDir;

View File

@ -55,7 +55,7 @@ class FileDownloader implements DownloaderInterface
$this->filesystem = $filesystem ?: new Filesystem();
$this->cache = $cache;
if ($this->cache && !self::$cacheCollected && !rand(0, 50)) {
if ($this->cache && !self::$cacheCollected && !mt_rand(0, 50)) {
$this->cache->gc($config->get('cache-ttl'), $config->get('cache-files-maxsize'));
}
self::$cacheCollected = true;

View File

@ -91,7 +91,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
;
do {
$path = sys_get_temp_dir().'/'.md5(time().rand());
$path = sys_get_temp_dir().'/'.md5(time().mt_rand());
} while (file_exists($path));
$ioMock = $this->getMock('Composer\IO\IOInterface');
@ -136,7 +136,7 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
;
do {
$path = sys_get_temp_dir().'/'.md5(time().rand());
$path = sys_get_temp_dir().'/'.md5(time().mt_rand());
} while (file_exists($path));
$downloader = $this->getDownloader();

View File

@ -236,7 +236,7 @@ class LibraryInstallerTest extends TestCase
protected function createPackageMock()
{
return $this->getMockBuilder('Composer\Package\Package')
->setConstructorArgs(array(md5(rand()), '1.0.0.0', '1.0.0'))
->setConstructorArgs(array(md5(mt_rand()), '1.0.0.0', '1.0.0'))
->getMock();
}
}

View File

@ -95,7 +95,7 @@ class MetapackageInstallerTest extends \PHPUnit_Framework_TestCase
private function createPackageMock()
{
return $this->getMockBuilder('Composer\Package\Package')
->setConstructorArgs(array(md5(rand()), '1.0.0.0', '1.0.0'))
->setConstructorArgs(array(md5(mt_rand()), '1.0.0.0', '1.0.0'))
->getMock();
}
}

View File

@ -31,7 +31,7 @@ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase
protected function initialize()
{
$oldCwd = getcwd();
self::$gitRepo = sys_get_temp_dir() . '/composer-git-'.rand().'/';
self::$gitRepo = sys_get_temp_dir() . '/composer-git-'.mt_rand().'/';
$locator = new ExecutableFinder();
if (!$locator->find('git')) {