Switched rand() to mt_rand()
parent
710f91c1e3
commit
470adc47df
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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')) {
|
||||
|
|
Loading…
Reference in New Issue