xref: /PHP-8.3/ext/spl/tests/bug42364.phpt (revision a555cc0b)
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--CLEAN--
24<?php
25unlink(__DIR__ . '/bug42364/test');
26rmdir(__DIR__ . '/bug42364');
27?>
28--EXPECTF--
29Found %i entries!
30