use correct class for RecursiveDirectoryIterator
That was one hell of a bug. They overwrote a subclass and expected the overwriting to stay when it created a new copy.
Esse commit está contido em:
@@ -75,7 +75,7 @@ class RecursiveDirectoryIterator extends FilesystemIterator
|
||||
if ($this->getFlags() & FilesystemIterator::CURRENT_AS_PATHNAME) {
|
||||
return $this->current();
|
||||
}
|
||||
$child = new self($this->getPathname(), $this->getFlags());
|
||||
$child = new static($this->getPathname(), $this->getFlags());
|
||||
$child->subPath = $this->subPath;
|
||||
if ($child->subPath) {
|
||||
$child->subPath .= DIRECTORY_SEPARATOR;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
class A extends RecursiveDirectoryIterator {
|
||||
public function current() {
|
||||
return 'a';
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
||||
$it = new RecursiveIteratorIterator(
|
||||
new A(__DIR__.'/../../sample_dir/'), RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
|
||||
foreach ($it as $a) {
|
||||
var_dump($a);
|
||||
}
|
||||
}
|
||||
main();
|
||||
@@ -0,0 +1,6 @@
|
||||
string(1) "a"
|
||||
string(1) "a"
|
||||
string(1) "a"
|
||||
string(1) "a"
|
||||
string(1) "a"
|
||||
string(1) "a"
|
||||
Referência em uma Nova Issue
Bloquear um usuário