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

[Finder] Fix ignoring of unreadable dirs in the RecursiveDirectoryIterator #10772

Merged
merged 1 commit into from Apr 24, 2014

Conversation

Projects
None yet
4 participants
@jakzal
Copy link
Member

commented Apr 23, 2014

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #10747
License MIT
Doc PR -

\RecursiveDirectoryIterator::getChildren() creates an instance of the current (overloaded) class with default constructor arguments. Therefore the ignoreUnreadableDirs is not passed to the child directories as @marcj suggested in #10747.

My fix relies on PHP's ability to modify private properties in objects of the same class. My reasoning behind choosing this approach, instead of using a setter, is that it's an internal detail which doesn't need to be part of a public interface.

Unfortunately, I can't really cover this case by tests.

return parent::getChildren();
$children = parent::getChildren();
if ($children instanceof RecursiveDirectoryIterator) {

This comment has been minimized.

Copy link
@Tobion

Tobion Apr 23, 2014

Member

maybe instanceof self which is more obvious

This comment has been minimized.

Copy link
@jakzal

jakzal Apr 23, 2014

Author Member

good idea 👍

@Tobion

This comment has been minimized.

Copy link
Member

commented Apr 23, 2014

Can you not add a test just as #10747 demonstrates?

@jakzal

This comment has been minimized.

Copy link
Member Author

commented Apr 23, 2014

How would I make a cleanup after test if I revoked permissions to myself?

@Tobion

This comment has been minimized.

Copy link
Member

commented Apr 23, 2014

Good question ;)

@fabpot

This comment has been minimized.

Copy link
Member

commented Apr 24, 2014

Thank you @jakzal.

@fabpot fabpot merged commit 1346641 into symfony:2.3 Apr 24, 2014

2 checks passed

continuous-integration/travis-ci The Travis CI build passed
Details
default Success: Travis, fabbot
Details

fabpot added a commit that referenced this pull request Apr 24, 2014

bug #10772 [Finder] Fix ignoring of unreadable dirs in the RecursiveD…
…irectoryIterator (jakzal)

This PR was merged into the 2.3 branch.

Discussion
----------

[Finder] Fix ignoring of unreadable dirs in the RecursiveDirectoryIterator

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #10747
| License       | MIT
| Doc PR        | -

`\RecursiveDirectoryIterator::getChildren()` creates an instance of the current (overloaded) class with default constructor arguments. Therefore the `ignoreUnreadableDirs` is not passed to the child directories as @marcj suggested in #10747.

My fix relies on PHP's ability to modify private properties in objects of the same class. My reasoning behind choosing this approach, instead of using a setter, is that it's an internal detail which doesn't need to be part of a public interface.

Unfortunately, I can't really cover this case by tests.

Commits
-------

1346641 [Finder] Fix ignoring of unreadable dirs in the RecursiveDirectoryIterator.

@jakzal jakzal deleted the jakzal:recursive-dir-iterator-fix branch Apr 24, 2014

@hice3000

This comment has been minimized.

Copy link
Contributor

commented May 5, 2014

Maybe someone should add an "incomplete" note to the according test so that we don't forget there is something missing.

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.