xref: /PHP-8.2/ext/standard/tests/file/bug36365.phpt (revision 767a77ac)
1--TEST--
2Bug #36365 (scandir duplicates file name at every 65535th file)
3--SKIPIF--
4<?php
5if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
6?>
7--FILE--
8<?php
9$testdir = __DIR__ . '/bug36365';
10
11mkdir($testdir);
12for ($i = 0; $i < 70000; $i++) {
13    touch(sprintf("$testdir/%05d.txt", $i));
14}
15
16var_dump(count(scandir($testdir)));
17?>
18--CLEAN--
19<?php
20$testdir = __DIR__ . '/bug36365';
21for ($i = 0; $i < 70000; $i++) {
22    unlink(sprintf("$testdir/%05d.txt", $i));
23}
24rmdir($testdir);
25?>
26--EXPECT--
27int(70002)
28