Skip to content

Commit

Permalink
bug #20132 Use "more entropy" option for uniqid() (javiereguiluz)
Browse files Browse the repository at this point in the history
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](https://github.com/php/php-src/blob/1c295d4a9ac78fcc2f77d6695987598bb7abcb83/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()
  • Loading branch information
fabpot committed Oct 3, 2016
2 parents 80577f9 + 4403e28 commit 3902dc5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -86,7 +86,7 @@ public function getProxyCandidates()
$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),
);

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Command/LintCommand.php
Expand Up @@ -109,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$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);
Expand Down

0 comments on commit 3902dc5

Please sign in to comment.