diff --git a/bin/console b/bin/console index 52fd3989..5d5c80fb 100755 --- a/bin/console +++ b/bin/console @@ -4,7 +4,11 @@ use App\Kernel; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Debug\Debug; +use Symfony\Component\ErrorHandler\Debug; + +if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { + echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL; +} set_time_limit(0); diff --git a/config/bootstrap.php b/config/bootstrap.php index e00c6e8c..976a7763 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -1,24 +1,4 @@ =1.2) -if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { - $_SERVER += $env; - $_ENV += $env; +if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV']) { + foreach ($env as $k => $v) { + $_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v); + } } elseif (!class_exists(Dotenv::class)) { throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } else { @@ -36,6 +17,7 @@ if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) { (new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env'); } +$_SERVER += $_ENV; $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/config/packages/test/validator.yaml b/config/packages/test/validator.yaml new file mode 100644 index 00000000..1e5ab788 --- /dev/null +++ b/config/packages/test/validator.yaml @@ -0,0 +1,3 @@ +framework: + validation: + not_compromised_password: false diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml index a695e1a6..350786a1 100644 --- a/config/packages/validator.yaml +++ b/config/packages/validator.yaml @@ -1,3 +1,8 @@ framework: validation: email_validation_mode: html5 + + # Enables validator auto-mapping support. + # For instance, basic validation constraints will be inferred from Doctrine's metadata. + #auto_mapping: + # App\Entity\: [] diff --git a/public/.htaccess b/public/.htaccess index bcce7fcc..0379bfca 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -27,12 +27,12 @@ DirectoryIndex index.php # work in environments without path prefix as well, providing a safe, one-size # fits all solution. But as you do not need it in this case, you can comment # the following 2 lines to eliminate the overhead. - RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ - RewriteRule ^(.*) - [E=BASE:%1] + RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$ + RewriteRule .* - [E=BASE:%1] # Sets the HTTP_AUTHORIZATION header removed by Apache - RewriteCond %{HTTP:Authorization} . - RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + RewriteCond %{HTTP:Authorization} .+ + RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0] # Redirect to URI without front controller to prevent duplicate content # (with and without `/index.php`). Only do this redirect on the initial @@ -45,15 +45,13 @@ DirectoryIndex index.php # - disable this feature by commenting the following 2 lines or # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the # following RewriteCond (best solution) - RewriteCond %{ENV:REDIRECT_STATUS} ^$ + RewriteCond %{ENV:REDIRECT_STATUS} ="" RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] # If the requested filename exists, simply serve it. # We only want to let Apache serve files and not directories. - RewriteCond %{REQUEST_FILENAME} -f - RewriteRule ^ - [L] - # Rewrite all other queries to the front controller. + RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ %{ENV:BASE}/index.php [L] diff --git a/symfony.lock b/symfony.lock index 3ade6334..3452f031 100644 --- a/symfony.lock +++ b/symfony.lock @@ -235,7 +235,7 @@ "repo": "github.com/symfony/recipes", "branch": "master", "version": "1.0", - "ref": "0cd4d2d0e7f646fda75f9944f747a56e6ed13d4c" + "ref": "7c0a9352a57376f04f5444e74565102c3a23d0c7" }, "files": [ "./config/packages/nyholm_psr7.yaml" @@ -419,7 +419,7 @@ "repo": "github.com/symfony/recipes-contrib", "branch": "master", "version": "1.0", - "ref": "c82bead70f9a4f656354a193df7bf0ca2114efa0" + "ref": "410b9325a37ef86f1e47262c61738f6202202bca" }, "files": [ "./public/.htaccess" @@ -441,12 +441,12 @@ "version": "v4.2.3" }, "symfony/console": { - "version": "3.3", + "version": "4.4", "recipe": { "repo": "github.com/symfony/recipes", "branch": "master", - "version": "3.3", - "ref": "0fa049c19069a65f52c1c181d64be3de672c1504" + "version": "4.4", + "ref": "fead3ab2e80622c61d13dac0d21a3430a45efae8" }, "files": [ "./bin/console", @@ -510,7 +510,7 @@ "repo": "github.com/symfony/recipes", "branch": "master", "version": "1.0", - "ref": "dc3fc2e0334a4137c47cfd5a3ececc601fa61a0b" + "ref": "c0eeb50665f0f77226616b6038a9b06c03752d8e" }, "files": [ "./.env" @@ -709,7 +709,7 @@ "repo": "github.com/symfony/recipes", "branch": "master", "version": "3.3", - "ref": "1fb02a6e1c8f3d4232cce485c9afa868d63b115a" + "ref": "2ad9d2545bce8ca1a863e50e92141f0b9d87ffcd" }, "files": [ "./config/packages/translation.yaml", @@ -737,14 +737,15 @@ ] }, "symfony/validator": { - "version": "4.1", + "version": "4.3", "recipe": { "repo": "github.com/symfony/recipes", "branch": "master", - "version": "4.1", - "ref": "0cdc982334f45d554957a6167e030482795bf9d7" + "version": "4.3", + "ref": "d902da3e4952f18d3bf05aab29512eb61cabd869" }, "files": [ + "./config/packages/test/validator.yaml", "./config/packages/validator.yaml" ] },