Skip to content

Commit

Permalink
minor #176 Use "more entropy" option when using uniqid() function (ja…
Browse files Browse the repository at this point in the history
…viereguiluz)

This PR was merged into the 2.x-dev branch.

Discussion
----------

Use "more entropy" option when using uniqid() function

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 this bundle still had some uniqid() calls without this option.

Commits
-------

2f52c4e Use "more entropy" option when usin uniqid() function
  • Loading branch information
stof committed Oct 3, 2016
2 parents bbce386 + 2f52c4e commit f3ae7ec
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions DependencyInjection/MonologExtension.php
Expand Up @@ -182,13 +182,13 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
$handler['publisher']['port'],
$handler['publisher']['chunk_size'],
));
$transportId = uniqid('monolog.gelf.transport.');
$transportId = uniqid('monolog.gelf.transport.', true);
$transport->setPublic(false);
$container->setDefinition($transportId, $transport);

$publisher = new Definition('%monolog.gelfphp.publisher.class%', array());
$publisher->addMethodCall('addTransport', array(new Reference($transportId)));
$publisherId = uniqid('monolog.gelf.publisher.');
$publisherId = uniqid('monolog.gelf.publisher.', true);
$publisher->setPublic(false);
$container->setDefinition($publisherId, $publisher);
} elseif (class_exists('Gelf\MessagePublisher')) {
Expand All @@ -198,7 +198,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
$handler['publisher']['chunk_size'],
));

$publisherId = uniqid('monolog.gelf.publisher.');
$publisherId = uniqid('monolog.gelf.publisher.', true);
$publisher->setPublic(false);
$container->setDefinition($publisherId, $publisher);
} else {
Expand Down Expand Up @@ -228,7 +228,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
$server,
));

$clientId = uniqid('monolog.mongo.client.');
$clientId = uniqid('monolog.mongo.client.', true);
$client->setPublic(false);
$container->setDefinition($clientId, $client);
}
Expand Down Expand Up @@ -269,7 +269,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
$elasticaClientArguments
));

$clientId = uniqid('monolog.elastica.client.');
$clientId = uniqid('monolog.elastica.client.', true);
$elasticaClient->setPublic(false);
$container->setDefinition($clientId, $elasticaClient);
}
Expand Down

0 comments on commit f3ae7ec

Please sign in to comment.