<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Dotenv\Dotenv; // JM 20211029
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
// JM 20211029 Début https://github.com/symfony/symfony/issues/35388
//$o = new Dotenv() ;
//(new Dotenv())->usePutenv(true)->bootEnv(dirname(__DIR__).'/.env');
// JM 20211029 Fin
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
// // LG 20220802 pour tests
// if (file_exists("/home/luc/partage_win10/Poubelle/")) {
// $jsonfile = "/home/luc/partage_win10/Poubelle/comparePasswords.txt";
// } else if (file_exists("/var/www/html/PAA/Recette/var/log/")) {
// $jsonfile = "/var/www/html/PAA/Recette/var/log/comparePasswords.txt";
// }
// if (isset($jsonfile)) {
// $lsLog = "Index.php response->getStatusCode() : " . $response->getStatusCode() . chr(13) ;
// file_put_contents($jsonfile, $lsLog, FILE_APPEND | LOCK_EX);
// }
$response->send();
$kernel->terminate($request, $response);