Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Do strict check on environment name in AppKernel.php #737

Closed
wants to merge 1 commit into from
Closed

Do strict check on environment name in AppKernel.php #737

wants to merge 1 commit into from

Conversation

gerryvdm
Copy link
Contributor

Enable strict in_array() comparison when conditionally enabling development bundles.

Enable strict in_array() checking for conditionally enabling development bundles.
@xabbuh
Copy link
Member

xabbuh commented Nov 27, 2014

Can you please explain why you think that this is necessary? getEnvironment() returns a string and the array elements are strings too.

@gerryvdm
Copy link
Contributor Author

There's nothing preventing me to initialize the kernel with the integer 0 for example, and I will enter the condition in that case.

Also I do believe that as far as strict checking is concerned, you should come up with a use-case to loosely check or do a strict check by default :)

@xabbuh
Copy link
Member

xabbuh commented Nov 27, 2014

Yeah, you can do that though the Kernel class expects the environment to be a string.

@ghost
Copy link

ghost commented Dec 18, 2014

i don't see why we shouldn't do it.

@Pierstoval
Copy link
Contributor

I don't see why we whould prevent users from initializing the kernel with integers, as I think you can also have integer environments (app_1.php, app_2.php, etc.).
If one day someone tries to initialize the kernel with an integer instead of a numeric string, he'll probably be stuck on this error for a while, whereas a non-strict check is useful for that.

@Tobion
Copy link
Contributor

Tobion commented Apr 17, 2015

This change doesn't add anything useful but also doesn't hurt. Maybe strict checking is even faster.
So lets just merge it. But should be done in 2.3.

@Pierstoval I think you are missing the point. It's only about array('dev', 'test'), so intergets will not match anyway.

@fabpot
Copy link
Member

fabpot commented Sep 13, 2015

Thank you @gerryvdm.

fabpot added a commit that referenced this pull request Sep 13, 2015
…yvdm)

This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #737).

Discussion
----------

Do strict check on environment name in AppKernel.php

Enable strict in_array() comparison when conditionally enabling development bundles.

Commits
-------

bc671aa Do strict check on environment name
@fabpot fabpot closed this Sep 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants