diff --git a/.env.dist b/.env.dist index a1600765a..16f1f219e 100644 --- a/.env.dist +++ b/.env.dist @@ -66,8 +66,8 @@ PAYBOX_IDENTIFIANT=110647233 BLOG_API_KEY=123456 SMTP_HOST="localhost" -SMTP_PORT="1025" -SMTP_TLS="0" +SMTP_PORT=1025 +SMTP_TLS=0 SMTP_USERNAME="" SMTP_PASSWORD="" MAILER_FORCE_RECIPIENTS="" diff --git a/dependencies/magpierss/extlib/Snoopy.class.inc b/dependencies/magpierss/extlib/Snoopy.class.inc index f138e5109..ad6f119b5 100644 --- a/dependencies/magpierss/extlib/Snoopy.class.inc +++ b/dependencies/magpierss/extlib/Snoopy.class.inc @@ -645,7 +645,7 @@ class Snoopy $cmdline_params .= " -m " . $this->read_timeout; } - $headerfile = uniqid(time()); + $headerfile = uniqid((string) time(), true); # accept self-signed certs $cmdline_params .= " -k"; @@ -857,7 +857,7 @@ class Snoopy break; case "multipart/form-data": - $this->_mime_boundary = "Snoopy" . md5(uniqid(microtime())); + $this->_mime_boundary = "Snoopy" . md5(uniqid((string) microtime())); reset($formvars); diff --git a/sources/AppBundle/Association/Model/User.php b/sources/AppBundle/Association/Model/User.php index 1df58202c..2f62b4cc6 100644 --- a/sources/AppBundle/Association/Model/User.php +++ b/sources/AppBundle/Association/Model/User.php @@ -582,7 +582,7 @@ public function getLastSubscription() public function setLastSubscription($sub) { if ($sub !== null) { - $this->lastSubscription = \DateTimeImmutable::createFromFormat('U', $sub); + $this->lastSubscription = \DateTimeImmutable::createFromFormat('U', (string)$sub); } } diff --git a/sources/AppBundle/Association/UserMembership/UserService.php b/sources/AppBundle/Association/UserMembership/UserService.php index a289be20a..4015c244c 100644 --- a/sources/AppBundle/Association/UserMembership/UserService.php +++ b/sources/AppBundle/Association/UserMembership/UserService.php @@ -41,7 +41,7 @@ public function __construct( public function generateRandomPassword() { - return substr(md5(uniqid(mt_rand(), true)), 0, 10); + return substr(md5(uniqid((string) mt_rand(), true)), 0, 10); } public function resetPassword(User $user) diff --git a/sources/AppBundle/Controller/Admin/Event/RemoveEventAction.php b/sources/AppBundle/Controller/Admin/Event/RemoveEventAction.php index 9c2c7469f..07dbd1f1b 100644 --- a/sources/AppBundle/Controller/Admin/Event/RemoveEventAction.php +++ b/sources/AppBundle/Controller/Admin/Event/RemoveEventAction.php @@ -61,7 +61,7 @@ public function __invoke($id, $token) return new RedirectResponse($this->urlGenerator->generate('admin_event_list')); } - if ($result->first()['est_supprimable'] !== '1') { + if ($result->first()['est_supprimable'] !== 1) { $this->flashBag->add('error', 'Impossible de supprimer un évènement utilisé'); return new RedirectResponse($this->urlGenerator->generate('admin_event_list')); } diff --git a/sources/AppBundle/Controller/Admin/HomeAction.php b/sources/AppBundle/Controller/Admin/HomeAction.php index 55cb02378..4a67d7a23 100644 --- a/sources/AppBundle/Controller/Admin/HomeAction.php +++ b/sources/AppBundle/Controller/Admin/HomeAction.php @@ -84,7 +84,7 @@ public function __invoke() } } - $info['statistics']['montant total'] = number_format($montantTotal, 0, 0, ' ') . ' €'; + $info['statistics']['montant total'] = number_format($montantTotal, 0, ',', ' ') . ' €'; $info['url'] = '/pages/administration/index.php?page=forum_inscriptions&id_forum=' . $event->getId(); $cards[] = $info; diff --git a/sources/AppBundle/Controller/Admin/LoginAction.php b/sources/AppBundle/Controller/Admin/LoginAction.php index 4c9db2c9e..44b8b448e 100644 --- a/sources/AppBundle/Controller/Admin/LoginAction.php +++ b/sources/AppBundle/Controller/Admin/LoginAction.php @@ -38,7 +38,7 @@ public function __invoke(Request $request) $lastUsername = $this->authenticationUtils->getLastUsername(); $actualUrl = $request->getSchemeAndHttpHost() . $request->getRequestUri(); - $targetUri = $request->query->get('target'); + $targetUri = $request->query->get('target', ''); $noDomain = parse_url($targetUri, PHP_URL_HOST) === null; $targetPath = $targetUri !== $actualUrl && $noDomain ? $targetUri : null; diff --git a/sources/AppBundle/Email/Emails.php b/sources/AppBundle/Email/Emails.php index 0900207e3..1d236aecf 100644 --- a/sources/AppBundle/Email/Emails.php +++ b/sources/AppBundle/Email/Emails.php @@ -35,8 +35,7 @@ public function __destruct() public function sendInscription(Event $event, MailUser $recipient) { $mailContent = $event->getMailInscriptionContent(); - - if ('' === trim($mailContent)) { + if (!$mailContent) { throw new InvalidArgumentException("Contenu du mail d'inscription non trouvé pour le forum " . $event->getTitle()); } @@ -61,7 +60,7 @@ public function sendInscription(Event $event, MailUser $recipient) private function getAttachementIcsInscription(Event $event, MailUser $recipient) { - $uid = md5($event->getId()); + $uid = md5((string) $event->getId()); $organizerCN = MailUserFactory::afup()->getName(); $attendeeCN = $recipient->getName(); $attendeeEmail = $recipient->getEmail(); diff --git a/sources/AppBundle/Event/Ticket/RegistrationsExportGenerator.php b/sources/AppBundle/Event/Ticket/RegistrationsExportGenerator.php index fba4c3724..49fe00a95 100644 --- a/sources/AppBundle/Event/Ticket/RegistrationsExportGenerator.php +++ b/sources/AppBundle/Event/Ticket/RegistrationsExportGenerator.php @@ -150,6 +150,9 @@ protected function getFromRegistrationsOnEvent(Event $event) */ private function extractAndCleanTags($comments) { + if (!$comments) { + return null; + } preg_match('@\(.*)\@i', $comments, $matches); $tags = isset($matches[1]) ? $matches[1] : ''; $tags = explode(';', $tags); diff --git a/sources/AppBundle/Github/GithubClient.php b/sources/AppBundle/Github/GithubClient.php index 8405e0ad1..ee1ff0716 100644 --- a/sources/AppBundle/Github/GithubClient.php +++ b/sources/AppBundle/Github/GithubClient.php @@ -45,7 +45,7 @@ public function getUserInfos($username) } if ($response->getStatusCode() === 200) { - return GithubUser::fromApi(json_decode($response->getBody(), true)); + return GithubUser::fromApi(json_decode($response->getBody()->getContents(), true)); } throw new UnableToGetGithubUserInfosException( diff --git a/sources/AppBundle/Offices/OfficeFinder.php b/sources/AppBundle/Offices/OfficeFinder.php index e0b595b05..918fdd2bf 100644 --- a/sources/AppBundle/Offices/OfficeFinder.php +++ b/sources/AppBundle/Offices/OfficeFinder.php @@ -202,10 +202,10 @@ private function haversineGreatCircleDistance( $latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo, $earthRadius = 6371000) { // convert from degrees to radians - $latFrom = deg2rad($latitudeFrom); - $lonFrom = deg2rad($longitudeFrom); - $latTo = deg2rad($latitudeTo); - $lonTo = deg2rad($longitudeTo); + $latFrom = deg2rad((float) $latitudeFrom); + $lonFrom = deg2rad((float) $longitudeFrom); + $latTo = deg2rad((float) $latitudeTo); + $lonTo = deg2rad((float) $longitudeTo); $latDelta = $latTo - $latFrom; $lonDelta = $lonTo - $lonFrom;