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

Avoid target directories within the source directory#29857

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

Closed
Fleuv wants to merge3 commits intosymfony:masterfromFleuv:master

Conversation

@Fleuv
Copy link
Contributor

QA
Branch?master
Bug fix?no, but kind of yes
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
LicenseMIT

Currently when you run:

$filesystem->mirror('/foo', '/foo/bar');

The method will get caught in a recursive loop of creating "bar" sub directories in the target directory.

This will happen:

/foo/bar/bar//foo/bar/bar/bar//foo/bar/bar/bar/bar/...

Until the path is so long that is validated as an invalid path string and thus mkdir() crashes.

In this pull request I implemented an if statement at the beginning of the foreach in the mirror() method. This if statement ensures that the target directory in the mirror process is skipped.

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneJan 24, 2019
@nicolas-grekas
Copy link
Member

That would qualify as a bug fix to me. Could you please rebase+retarget for 3.4?
Don't forget to fix failures while doing so.
Thanks.

@nicolas-grekas
Copy link
Member

Continued in#30116, thanks@Fleuv

fabpot added a commit that referenced this pull requestMar 31, 2019
…in his child with realpath checks (Fleuv, XuruDragon)This PR was merged into the 4.3-dev branch.Discussion----------[Filesystem] Fix mirroring a directory into itself or in his child with realpath checks| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | none / PR#29857| License       | MIT| Doc PR        | n/aThis this the continuity of#29857 by@FleuvFix a bug while trying to mirror a directory into itself or in a childAdding handle real path checks when mirroring.Commits-------8011f49 Handling relative/absolute path59437a4 Skipping iterations in the mirror() method where the iterated file's path name is equal to the target path
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

4 participants

@Fleuv@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp