I have issue while using glob function when path directory with square brackets.
// Example 1 - working $path = \'temp\'. DIRECTORY_SEPARATOR .\'dir - name\'
This is what I use: $path = str_replace(['[',']',"\f[","\f]"], ["\f[","\f]",'[[]','[]]'], $path);
$path = str_replace(['[',']',"\f[","\f]"], ["\f[","\f]",'[[]','[]]'], $path);
All in one line.