xref: /PHP-7.4/ext/spl/tests/bug42364.phpt (revision bb8ea4d6)
1--TEST--
2Bug #42364 (Crash when using getRealPath with DirectoryIterator)
3--FILE--
4<?php
5$dir = __DIR__ . '/bug42364';
6@mkdir($dir);
7touch($dir . '/test');
8
9$count = 0;
10$it = new DirectoryIterator($dir);
11foreach ($it as $e) {
12    $count++;
13    $type = gettype($e->getRealPath());
14    if ($type != "string" && $type != "unicode") {
15        echo $e->getFilename(), " is a ", gettype($e->getRealPath()), "\n";
16    }
17}
18
19if ($count > 0) {
20    echo "Found $count entries!\n";
21}
22?>
23===DONE===
24--CLEAN--
25<?php
26unlink(__DIR__ . '/bug42364/test');
27rmdir(__DIR__ . '/bug42364');
28?>
29--EXPECTF--
30Found %i entries!
31===DONE===
32