bug #20132 Use "more entropy" option for uniqid() (javiereguiluz)

This PR was squashed before being merged into the 2.7 branch (closes #20132).

Discussion
----------

Use "more entropy" option for uniqid()

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

As you can see in [the source code of the PHP uniqid() function](1c295d4a9a/ext/standard/uniqid.c (L68)) when you don't pass `true` as the second argument, PHP sleeps the application for 1 microsecond (`usleep(1)`)

Symfony uses `true` almost everywhere, but there are still some places (mostly in bundles) where this is not the case.

Commits
-------

4403e28 Use "more entropy" option for uniqid()
This commit is contained in:
Fabien Potencier 2016-10-03 08:22:08 -07:00
commit 3902dc59e1
2 changed files with 2 additions and 2 deletions

View File

@ -86,7 +86,7 @@ class ProxyDumperTest extends \PHPUnit_Framework_TestCase
$definitions = array(
array(new Definition(__CLASS__), true),
array(new Definition('stdClass'), true),
array(new Definition('foo'.uniqid()), false),
array(new Definition(uniqid('foo', true)), false),
array(new Definition(), false),
);

View File

@ -109,7 +109,7 @@ EOF
$template .= fread(STDIN, 1024);
}
return $this->display($input, $output, array($this->validate($twig, $template, uniqid('sf_'))));
return $this->display($input, $output, array($this->validate($twig, $template, uniqid('sf_', true))));
}
$filesInfo = $this->getFilesInfo($twig, $filenames);