10000 [DI] Fix hardcoded cache dir for warmups by nicolas-grekas · Pull Request #26662 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DI] Fix hardcoded cache dir for warmups #26662

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

Merged
merged 1 commit into from
Mar 28, 2018

Conversation

nicolas-grekas
Copy link
Member
@nicolas-grekas nicolas-grekas commented Mar 23, 2018
Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #26506, #26219
License MIT
Doc PR -

@@ -963,7 +963,7 @@ public function __construct()

EOF;
if (null !== $this->targetDirRegex) {
Copy link
Member

Choose a reason for hiding this comment

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

in which case can this regex be null ? The $this->containerDir variable will not be assigned at all currently in this case.

Copy link
Member

Choose a reason for hiding this comment

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

OK, looking at it, it might happens in some cases. So I suggest you to move the $this->containerDir = $dir assignment to a dedicated statement added in the compiled code outside this if

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed, wrong "if", fixed thanks

@@ -963,7 +963,7 @@ public function __construct()

EOF;
if (null !== $this->targetDirRegex) {
Copy link
Member

Choose a reason for hiding this comment

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

OK, looking at it, it might happens in some cases. So I suggest you to move the $this->containerDir = $dir assignment to a dedicated statement added in the compiled code outside this if

$code = str_replace('$parameters', "\$buildParameters;\n private \$parameters", $code);
$code = str_replace('__construct()', '__construct(array $buildParameters = array())', $code);
$code = str_replace('$parameters', "\$buildParameters;\n private \$containerDir;\n private \$parameters", $code);
$code = str_replace('__construct()', '__construct(array $buildParameters = array(), $dir = __DIR__)', $code);
Copy link
Member

Choose a reason for hiding this comment

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

the default value of the argument is broken. The compiled code expects the containerDir to end with a directory separator.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@fabpot
Copy link
Member
fabpot commented Mar 28, 2018

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 599dbca into symfony:3.4 Mar 28, 2018
fabpot added a commit that referenced this pull request Mar 28, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Fix hardcoded cache dir for warmups

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26506, #26219
| License       | MIT
| Doc PR        | -

Commits
-------

599dbca [DI] Fix hardcoded cache dir for warmups
@nicolas-grekas nicolas-grekas deleted the di-warmup-path branch April 2, 2018 12:07
This was referenced Apr 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0