Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[TwigBundle] fixed template root path#20428

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromfabpot:twig-relative-paths-fix
Nov 9, 2016

Conversation

@fabpot
Copy link
Member

QA
Branch?master
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed ticketssee#20285
LicenseMIT
Doc PRn/a

Simperfit reacted with thumbs up emoji
@javiereguiluz
Copy link
Member

👍

Status: reviewed

@linaori
Copy link
Contributor

This is not fool proof though, what about an approach such as here?
https://github.com/hostnet/path-composer-plugin-lib

@fabpot
Copy link
MemberAuthor

@iltar Can you explain in which circumstances it would not work?

@linaori
Copy link
Contributor

linaori commentedNov 8, 2016
edited
Loading

If I understand this PR correctly, it will traverse down until it find acomposer.json (based on the kernel root). What if my composer.json is in (e.g.)%kernel.root_dir%/.composer or my kernel is shared between repositories and installed globally? Edge, case would be a weird situation but not impossible, possible not probable. With--working-dir, you can have acomposer.json in any location of your system, it doesn't have to be in your repository.

There are just some cases that make this a bit difficult to ensure this would work.

@nicolas-grekas
Copy link
Member

I suggest using the common prefix between the vendor dir and the kernel.root_dir, as done in

$baseDir =array();
$rootDir =$container->getParameter('kernel.root_dir');
$rootDir =explode(DIRECTORY_SEPARATOR,realpath($rootDir) ?:$rootDir);
$bundleDir =explode(DIRECTORY_SEPARATOR,__DIR__);
for ($i =0;isset($rootDir[$i],$bundleDir[$i]); ++$i) {
if ($rootDir[$i] !==$bundleDir[$i]) {
break;
}
$baseDir[] =$rootDir[$i];
}
$baseDir =implode(DIRECTORY_SEPARATOR,$baseDir);

twoleds reacted with thumbs up emoji

@fabpot
Copy link
MemberAuthor

@nicolas-grekas I prefer my strategy. Storing thecomposer.json (which should be in your repository) elsewhere than the root directory is I think not something we need to support (and a nightmare for anyone doing this). But thevendor directory can be anywhere (there is even a configuration for that incomposer.json:vendor-dir). As thevendor should not be in your repo, and because this is just a read-only artifact, I can easily see people storing that somewhere else.

@iltar I don't want to support the edge cases you mention, they are non standard and I don't see why it would be a good idea in the first place. Supporting bad practices is not a goal.

linaori reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

👍

1 similar comment
@Tobion
Copy link
Contributor

👍

@fabpotfabpot merged commit526b8a0 intosymfony:masterNov 9, 2016
fabpot added a commit that referenced this pull requestNov 9, 2016
This PR was merged into the 3.2-dev branch.Discussion----------[TwigBundle] fixed template root path| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | see#20285| License       | MIT| Doc PR        | n/aCommits-------526b8a0 [TwigBundle] fixed template root path

if (!$container->has('templating')) {
$loader =$container->getDefinition('twig.loader.native_filesystem');
$loader->replaceArgument(1,$this->getComposerRootDir($container->getParameter('kernel.root_dir')));
Copy link
Member

Choose a reason for hiding this comment

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

why is it configured only for when the templating componnet is disabled ? Shouldtwig.loader.filesystem configure it too ?

@fabpotfabpot mentioned this pull requestNov 17, 2016
@fabpotfabpot deleted the twig-relative-paths-fix branchJanuary 7, 2017 00:34
@pounard
Copy link
Contributor

This causes problems as soon as you are a bit paranoid with open_basedir or deliver a project without the composer.json file:#22149

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.2

Development

Successfully merging this pull request may close these issues.

8 participants

@fabpot@javiereguiluz@linaori@nicolas-grekas@Tobion@pounard@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp