-
Notifications
You must be signed in to change notification settings - Fork 7.7k
/
bug77263.phpt
40 lines (33 loc) · 975 Bytes
/
bug77263.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--TEST--
Bug #77263 (Segfault when using 2 RecursiveFilterIterator)
--FILE--
<?php
$dir = __DIR__ . '/bug77263';
mkdir($dir);
mkdir("$dir/subdir");
touch("$dir/file1");
touch("$dir/subdir/file2");
class Filter1 extends RecursiveFilterIterator {
public function accept() { return $this->getInnerIterator()->getSubPathname() != ''; }
}
class Filter2 extends RecursiveFilterIterator {
public function accept() { return $this->getInnerIterator()->getSubPathname() != ' '; }
}
$iterator = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS );
$iterator = new Filter1( $iterator );
$iterator = new Filter2( $iterator );
$iterator = new RecursiveIteratorIterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD );
foreach ( $iterator as $item ) {
}
?>
OK
--CLEAN--
<?php
$dir = __DIR__ . '/bug77263';
unlink("$dir/file1");
unlink("$dir/subdir/file2");
rmdir("$dir/subdir");
rmdir($dir);
?>
--EXPECT--
OK