From 8bec0a9f9c8e69f9374af20ee13bab144c69e175 Mon Sep 17 00:00:00 2001 From: Paul Tarjan Date: Wed, 24 Jul 2013 02:27:11 -0700 Subject: [PATCH] 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. --- .../iterators/RecursiveDirectoryIterator.php | 2 +- .../RecursiveDirectoryIterator_keep_class.php | 19 +++++++++++++++++++ ...iveDirectoryIterator_keep_class.php.expect | 6 ++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 hphp/test/slow/ext_iterator/RecursiveDirectoryIterator_keep_class.php create mode 100644 hphp/test/slow/ext_iterator/RecursiveDirectoryIterator_keep_class.php.expect diff --git a/hphp/system/php/spl/iterators/RecursiveDirectoryIterator.php b/hphp/system/php/spl/iterators/RecursiveDirectoryIterator.php index 6f75b3f16..d2bceee95 100644 --- a/hphp/system/php/spl/iterators/RecursiveDirectoryIterator.php +++ b/hphp/system/php/spl/iterators/RecursiveDirectoryIterator.php @@ -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; diff --git a/hphp/test/slow/ext_iterator/RecursiveDirectoryIterator_keep_class.php b/hphp/test/slow/ext_iterator/RecursiveDirectoryIterator_keep_class.php new file mode 100644 index 000000000..c521b107c --- /dev/null +++ b/hphp/test/slow/ext_iterator/RecursiveDirectoryIterator_keep_class.php @@ -0,0 +1,19 @@ +