Skip to content

[Filesystem] mirror does not deal with sub-files with same name as source or target. #23472

@gitlost

Description

@gitlost
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 2.7

The use of str_replace() in Filesystem::mirror() means that it can't deal with sub-files or directories that match the name of the source (on copy), or target (on deleting existing content). For instance:

$symfony_fs_path = '/blah';

require $symfony_fs_path . 'Filesystem.php';

use Symfony\Component\Filesystem\Filesystem;

$fs = new Filesystem();

mkdir('/tmp/foo/foo/', 0777, true);

chdir('/tmp');

$fs->mirror('foo', 'bar');

Results in /tmp/bar/bar, not the expected /tmp/bar/foo.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions