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

[5.8] getNamespace is independent #27915

Merged
merged 1 commit into from Mar 18, 2019

Conversation

Projects
None yet
3 participants
@xuanquynh
Copy link
Contributor

xuanquynh commented Mar 18, 2019

Application::getNamespace() currently uses global helpers in which the first call to this method is the call to global container instance only because Application constructor sets it via Application::registerBaseBindings(). Application::getNamespace() is independent and returns the namespace itself. This pull request solves by using the exact methods of Application rather than global helpers.

See the example below for more details:

  • Step 1: The application laravel1/composer.json
{
    "autoload": {
        "psr-4": {
            "Laravel\\One\\": "app/"
        }
    }
}
  • Step 2: The application laravel2/composer.json
{
    "autoload": {
        "psr-4": {
            "Laravel\\Two\\": "app/"
        }
    }
}
  • Step 3: Create 2 application instances in a single process:
$app1 = new Application(realpath(__DIR__.'/path/to/laravel1'));
$app2 = new Application(realpath(__DIR__.'/path/to/laravel2'));
// Initialize but I haven't called getNamespace() from them.

Expected

$app1->getNamespace(); // "Laravel\\One\\"
$app2->getNamespace(); // "Laravel\\Two\\"

Actual

$app1->getNamespace(); // "Laravel\\Two\\"
$app2->getNamespace(); // "Laravel\\Two\\"
@driesvints

This comment has been minimized.

Copy link
Member

driesvints commented Mar 18, 2019

@xuanquynh please always provide the full description to your initial comment and not link to an external issue/pr.

@xuanquynh

This comment has been minimized.

Copy link
Contributor Author

xuanquynh commented Mar 18, 2019

@driesvints I updated (just copy from my earlier pr) . OK, I will provide on the later pull requests/issues.

@taylorotwell taylorotwell merged commit c2410f0 into laravel:5.8 Mar 18, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@xuanquynh xuanquynh deleted the xuanquynh:getNamespace_is_independent branch Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.