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:
Paul Tarjan
2013-07-24 02:27:11 -07:00
commit de Sara Golemon
commit 8bec0a9f9c
3 arquivos alterados com 26 adições e 1 exclusões
@@ -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"