-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[2.1][Component][Finder] $this->current() fix #4335
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
Conversation
Probably it should go to master branch, because it improves commit done to master: |
$iterator = new FilecontentFilterIterator($inner, array('file r+'), array()); | ||
$array = iterator_to_array($iterator); | ||
} | ||
|
||
} | ||
|
||
class ContentInnerNameIterator extends \ArrayIterator | ||
class FauxFile extends \SplFileInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FauxFile
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Faux => not real. MockFile will be better? Maybe MockSplFileInfo?
* | ||
* @return string the contents of the file | ||
*/ | ||
public function fileGetContents() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not getContents()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
$error = error_get_last(); | ||
throw new \RuntimeException($error['message']); | ||
} | ||
return $content; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing empty line before the return statement
seems good |
Commits ------- 3eb67fc [2.1][Component][Finder] $this->current() fix Discussion ---------- [2.1][Component][Finder] $this->current() fix Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: [](http://travis-ci.org/gajdaw/symfony) Fixes the following tickets: - Todo: - License of the code: MIT One method to resolve `->in("ftp://...")` problem is to create `RecursiveDirectoryFtpIterator`. (Details: [issue 3585](#3585)) I think that all filters should access the information about current item calling `current()` or `getInnerIterator()`. Otherwise it will not work if we replace `RecursiveDirectoryIterator` with ftp iterator inside `Finder`. I'm not sure if that should go to 2.0 or 2.1 branch. --------------------------------------------------------------------------- by travisbot at 2012-05-19T09:20:19Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1373361) (merged 9f247921 into 58b9245). --------------------------------------------------------------------------- by gajdaw at 2012-05-19T10:51:10Z Probably it should go to master branch, because it improves commit done to master: f2fea97 --------------------------------------------------------------------------- by travisbot at 2012-05-19T11:26:14Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1373982) (merged f9d1db8c into 58b9245). --------------------------------------------------------------------------- by travisbot at 2012-05-19T11:51:25Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1374031) (merged f1b4b4f7 into 58b9245). --------------------------------------------------------------------------- by travisbot at 2012-05-19T12:48:17Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1374303) (merged b6d073da into 58b9245). --------------------------------------------------------------------------- by travisbot at 2012-05-19T13:28:18Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1374568) (merged fd144c96 into 58b9245). --------------------------------------------------------------------------- by travisbot at 2012-05-19T13:35:38Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1374609) (merged 89a8d851 into 58b9245). --------------------------------------------------------------------------- by travisbot at 2012-05-21T04:31:46Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1385764) (merged 0d5b8322 into 58b9245). --------------------------------------------------------------------------- by travisbot at 2012-05-21T07:21:56Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1386545) (merged 3eb67fc into 1407f11). --------------------------------------------------------------------------- by stof at 2012-06-09T13:24:14Z seems good
public function getContents() | ||
{ | ||
$level = error_reporting(0); | ||
$content = file_get_contents($this->getRealpath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use openFile and SplFileObject::fpassthu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stealth35 Do you mean something like https://github.com/gajdaw/symfony/commit/5b3501acdca3097331a5adf1d239d448863ddc8d ?
As of the latest pull, using an FTP stream wrapper still respond with a warning: "PHP Warning: FilesystemIterator::rewind(): stream does not support seeking", and misses the first file in every folder |
@housebolt Please open a ticket instead of commenting on a PR merged 4 months ago (as this would be lost) |
@stof, am in the process of putting together a ticket, just making it known for those who run into the same issue and come across this thread, thanks. |
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass:
Fixes the following tickets: -
Todo: -
License of the code: MIT
One method to resolve
->in("ftp://...")
problem is to createRecursiveDirectoryFtpIterator
.(Details: issue 3585)
I think that all filters should access the information about current item calling
current()
orgetInnerIterator()
. Otherwise it will not work if we replaceRecursiveDirectoryIterator
with ftp iterator insideFinder
.I'm not sure if that should go to 2.0 or 2.1 branch.