1--TEST--
2Glob wrapper bypasses open_basedir
3--INI--
4open_basedir=/does_not_exist
5--SKIPIF--
6<?php
7if (!in_array("glob", stream_get_wrappers())) echo "skip";
8--FILE--
9<?php
10
11foreach ( [ __DIR__, "glob://".__DIR__ ] as $spec) {
12  echo "** Opening $spec\n";
13  $dir = opendir($spec);
14  if (!$dir) {
15    echo "Failed to open $spec\n";
16    continue;
17  }
18  if (false === readdir($dir)) {
19    echo "No files in $spec\n";
20    continue;
21  }
22}
23?>
24--EXPECTF--
25** Opening %s
26
27Warning: opendir(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (/does_not_exist) in %s%eglob-wrapper.php on line 5
28
29Warning: opendir(%s): Failed to open directory: Operation not permitted in %s%eglob-wrapper.php on line 5
30Failed to open %s
31** Opening glob://%s
32
33Warning: opendir(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (/does_not_exist) in %s%eglob-wrapper.php on line 5
34
35Warning: opendir(glob://%s): Failed to open directory: operation failed in %s%eglob-wrapper.php on line 5
36Failed to open glob://%s
37