Skip to content

Warning: Undefined array key "APP_ENV" #312

@lance1572

Description

@lance1572

Describe the bug

Getting a warning "Undefined array key "APP_ENV" from

PHP Warning: Undefined array key "APP_ENV" in /Users/user/Desktop/new-app/vendor/leafs/mvc-core/src/Core.php on line 527

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'https://leafphp.dev/learn/mvc.html'

  2. leaf create my-app --mvc

  3. cd my-app
    php leaf serve

  4. Page Loads with Warning: Undefined array key "APP_ENV" in /Users/user/Desktop/new-app/vendor/leafs/mvc-core/src/Core.php on line 527

I see another closed issue similar to this.

#308

I've followed the steps in that issue by running composer update and replacing the index.php with the code supplied. Im not sure what is happening. However, if I add an isset, the warning goes away.

Core.php line 527

if (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] !== 'production')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions