From 91fb30ed40452f0566cfabc225b78079346e1877 Mon Sep 17 00:00:00 2001 From: thisfro Date: Tue, 15 Jun 2021 15:56:42 +0200 Subject: [PATCH] Use uniqid() instead of random_bytes() --- src/Controller/OfferController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Controller/OfferController.php b/src/Controller/OfferController.php index 846f04f..f4551b7 100644 --- a/src/Controller/OfferController.php +++ b/src/Controller/OfferController.php @@ -50,7 +50,7 @@ class OfferController extends AbstractController $offer->setCreatedAt(new \DateTime()); if ($photo = $form['photo']->getData()) { - $filename = bin2hex(random_bytes(6)).'.'.$photo->guessExtension(); + $filename = uniqid().'.'.$photo->guessExtension(); try { $photo->move($photoDir, $filename); } catch (FileException $e) { @@ -103,7 +103,7 @@ class OfferController extends AbstractController public function editOffer(Offering $offer, OfferingRepository $offerRepository, Request $request, string $photoDir): Response { $form = $this->createForm(OfferingFormType::class, $offer); - $user = $this->getUser(); + $user = $this->getUser(); if ($offer->getByUser() === $user) { $form->handleRequest($request); @@ -113,7 +113,7 @@ class OfferController extends AbstractController $offer->setCreatedAt(new \DateTime()); if ($photo = $form['photo']->getData()) { - $filename = bin2hex(random_bytes(6)).'.'.$photo->guessExtension(); + $filename = uniqid(random_bytes(6)).'.'.$photo->guessExtension(); try { $photo->move($photoDir, $filename); } catch (FileException $e) {