Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use phpdotenv methods instead of getenv/putenv #7425

Merged
merged 1 commit into from
Feb 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public function bootstrap(Application $app)
{
try
{
Dotenv::makeMutable();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unrelated. Please send it separately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I explained here why I've added Dotenv::makeMutable() before Dotenv::load() : 866a8cf


Dotenv::load($app['path.base'], $app->environmentFile());
}
catch (InvalidArgumentException $e)
Expand Down
5 changes: 3 additions & 2 deletions src/Illuminate/Foundation/Testing/ApplicationTrait.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace Illuminate\Foundation\Testing;

use Dotenv;
use Illuminate\Http\Request;
use Illuminate\Contracts\Auth\Authenticatable as UserContract;

Expand All @@ -26,8 +27,8 @@ trait ApplicationTrait {
*/
protected function refreshApplication()
{
putenv('APP_ENV=testing');
Dotenv::setEnvironmentVariable('APP_ENV', 'testing');

$this->app = $this->createApplication();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,9 @@ function view($view = null, $data = array(), $mergeData = array())
*/
function env($key, $default = null)
{
$value = getenv($key);
$value = Dotenv::findEnvironmentVariable($key);

if ($value === false) return value($default);
if ($value === null) return value($default);

switch (strtolower($value))
{
Expand Down