Merge pull request #18 from igrizzli/develop

Readdir infinity reading fix
This commit is contained in:
Andrew Lawson 2016-04-22 08:46:29 +01:00
commit 610649d759
2 changed files with 25 additions and 0 deletions

View File

@ -84,6 +84,8 @@ class DirectoryHandle extends AbstractHandle
return $name; return $name;
} }
} }
return false;
} }
public function write($content) public function write($content)

View File

@ -0,0 +1,23 @@
<?php
namespace Vfs\Stream\StreamWrapper;
use Vfs\Test\AcceptanceTestCase;
class ReadDirAcceptanceTest extends AcceptanceTestCase
{
protected $tree = [
'foo' => [
'bar' => 'baz'
]
];
public function testReadDirectory()
{
$dHandler = opendir("$this->scheme:///foo");
$expects = ['bar' => true, '.' => true, '..' => true];
while(($file = readdir($dHandler)) !== false) {
$this->assertArrayHasKey($file, $expects);
}
}
}