Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[WebServerBundle] Under certain conditions, APP_ENV is an empty string #25754

Closed
@kbond

Description

@kbond
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.4+

Steps to reproduce:

  1. composer create-project symfony/skeleton my-project
  2. cd my-project
  3. composer require --dev profiler webserver
  4. bin/console server:start
  5. Navigate to http://127.0.0.1:8000/foo/bar
  6. You get a 404 as expected and the profiler toolbar shows the dev environment as expected
  7. mkdir public/foo
  8. Again navigate to http://127.0.0.1:8000/foo/bar
  9. Notice the profiler toolbar is missing and if you inspect the $env var in public/index.php it is an empty string

I think this bug is related to #23799 (https://github.com/symfony/symfony/pull/23799/files#diff-17a9fecf57df3ecbd28ddf129c45ff70R157) but I'm not sure why creating a the /foo directory causes this issue.

A work around is to change the following in public/index.php:

if (!isset($_SERVER['APP_ENV'])) {

to:

if (!isset($_SERVER['APP_ENV']) || !$_SERVER['APP_ENV']) {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions