mirror of
https://github.com/adlawson/php-vfs.git
synced 2024-11-23 21:27:39 +00:00
Fix directory reading. Return FALSE on directory end instead empty string for avoiding infinity readdir cycles.
This commit is contained in:
parent
e955034419
commit
70876cd1fa
@ -84,6 +84,8 @@ class DirectoryHandle extends AbstractHandle
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function write($content)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user