From 6bad26b119887d95b938fb3eb8629f9c60675d48 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Wed, 7 Jun 2017 18:38:20 -0700 Subject: [PATCH] Fix creating a FileSystem iterator from a non-string arg Summary: Used by parts of symfony that composer users when creating zips/tars/phars refs #7869 Depends on D5202473 Reviewed By: paulbiss Differential Revision: D5202739 fbshipit-source-id: b0a935bb56ec41425fefad6aa87be7a28fc3a4ec --- hphp/system/php/spl/iterators/FilesystemIterator.php | 2 +- hphp/test/frameworks/results/composer_php7.expect | 12 ++++++------ .../slow/ext_spl_iterators/iterator_of_object.php | 5 +++++ .../ext_spl_iterators/iterator_of_object.php.expect | 1 + .../ext_spl_iterators/iterator_of_object.php.ini | 1 + 5 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 hphp/test/slow/ext_spl_iterators/iterator_of_object.php create mode 100644 hphp/test/slow/ext_spl_iterators/iterator_of_object.php.expect create mode 100644 hphp/test/slow/ext_spl_iterators/iterator_of_object.php.ini diff --git a/hphp/system/php/spl/iterators/FilesystemIterator.php b/hphp/system/php/spl/iterators/FilesystemIterator.php index 602d1428cec184..65080725281619 100644 --- a/hphp/system/php/spl/iterators/FilesystemIterator.php +++ b/hphp/system/php/spl/iterators/FilesystemIterator.php @@ -40,7 +40,7 @@ class FilesystemIterator extends DirectoryIterator { * @return mixed No value is returned. */ public function __construct($path, $flags = null) { - parent::__construct($path); + parent::__construct((string) $path); if ($flags === null) { $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | diff --git a/hphp/test/frameworks/results/composer_php7.expect b/hphp/test/frameworks/results/composer_php7.expect index 563470990461ea..a99e0353f9ca7b 100644 --- a/hphp/test/frameworks/results/composer_php7.expect +++ b/hphp/test/frameworks/results/composer_php7.expect @@ -1095,13 +1095,13 @@ Composer\Test\Json\JsonValidationExceptionTest::testGetErrors with data set #1 Composer\Test\Json\JsonValidationExceptionTest::testGetErrorsWhenNoErrorsProvided . Composer\Test\Package\Archiver\ArchivableFilesFinderTest::testGitExcludes -E +. Composer\Test\Package\Archiver\ArchivableFilesFinderTest::testHgExcludes -E +F Composer\Test\Package\Archiver\ArchivableFilesFinderTest::testManualExcludes -E +. Composer\Test\Package\Archiver\ArchivableFilesFinderTest::testSkipExcludes -E +. Composer\Test\Package\Archiver\ArchiveManagerTest::testArchiveCustomFileName E Composer\Test\Package\Archiver\ArchiveManagerTest::testArchiveTar @@ -1125,9 +1125,9 @@ Composer\Test\Package\Archiver\HgExcludeFilterTest::testPatternEscape with data Composer\Test\Package\Archiver\PharArchiverTest::testTarArchive E Composer\Test\Package\Archiver\PharArchiverTest::testZipArchive -E +. Composer\Test\Package\Archiver\ZipArchiverTest::testZipArchive -E +. Composer\Test\Package\BasePackageTest::testFormatVersionForDevPackage with data set #0 . Composer\Test\Package\BasePackageTest::testFormatVersionForDevPackage with data set #1 diff --git a/hphp/test/slow/ext_spl_iterators/iterator_of_object.php b/hphp/test/slow/ext_spl_iterators/iterator_of_object.php new file mode 100644 index 00000000000000..ee88c2381193a3 --- /dev/null +++ b/hphp/test/slow/ext_spl_iterators/iterator_of_object.php @@ -0,0 +1,5 @@ +getPath() === sys_get_temp_dir()); diff --git a/hphp/test/slow/ext_spl_iterators/iterator_of_object.php.expect b/hphp/test/slow/ext_spl_iterators/iterator_of_object.php.expect new file mode 100644 index 00000000000000..ea5b1fdc3c0f5a --- /dev/null +++ b/hphp/test/slow/ext_spl_iterators/iterator_of_object.php.expect @@ -0,0 +1 @@ +bool(true) diff --git a/hphp/test/slow/ext_spl_iterators/iterator_of_object.php.ini b/hphp/test/slow/ext_spl_iterators/iterator_of_object.php.ini new file mode 100644 index 00000000000000..5fe8cb8e0d0440 --- /dev/null +++ b/hphp/test/slow/ext_spl_iterators/iterator_of_object.php.ini @@ -0,0 +1 @@ +hhvm.php7.all