xref: /PHP-8.4/ext/standard/tests/file/bug69628.phpt (revision 26dfce7f)
1--TEST--
2Bug #69628: GLOB_BRACE with multiple brackets within the braces fails
3--SKIPIF--
4<?php
5if (!defined('GLOB_BRACE')) {
6    die('skip this test requires GLOB_BRACE support');
7}
8?>
9--FILE--
10<?php
11
12$file_path = __DIR__;
13
14// temp dirname used here
15$dirname = "$file_path/bug69628";
16
17// temp dir created
18mkdir($dirname);
19
20// temp files created
21file_put_contents("$dirname/image.jPg", '');
22file_put_contents("$dirname/image.gIf", '');
23file_put_contents("$dirname/image.png", '');
24
25sort_var_dump(glob("$dirname/*.{[jJ][pP][gG],[gG][iI][fF]}", GLOB_BRACE));
26
27function sort_var_dump($results) {
28   sort($results);
29   var_dump($results);
30}
31
32?>
33--CLEAN--
34<?php
35
36$file_path = __DIR__;
37unlink("$file_path/bug69628/image.jPg");
38unlink("$file_path/bug69628/image.gIf");
39unlink("$file_path/bug69628/image.png");
40rmdir("$file_path/bug69628/");
41
42?>
43--EXPECTF--
44array(2) {
45  [0]=>
46  string(%d) "%s/bug69628/image.gIf"
47  [1]=>
48  string(%d) "%s/bug69628/image.jPg"
49}
50