2

Getting Notice and Warning Bellow

Notice: Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE' in /var/www/html/opencart/upload/admin/controller/extension/extension.php on line 2

Warning: glob(): At least one of the passed flags is invalid or not supported on this platform in /var/www/html/opencart/upload/admin/controller/extension/extension.php on line 41

Warning: Invalid argument supplied for foreach() in /var/www/html/opencart/upload/admin/controller/extension/extension.php on line 44

When i list all defined constant GLOB_BRACE is missing.

GLOB_MARK => 2
GLOB_NOSORT => 4
GLOB_NOCHECK => 16
GLOB_NOESCAPE => 64
GLOB_ERR => 1
GLOB_ONLYDIR => 1073741824
GLOB_AVAILABLE_FLAGS => 1073741911

Operating System,php, Opencart Version:

  • Linux opencart-77fcc87595-2gqvw 4.4.86+ #1 SMP Thu Dec 7 20:11:11 PST 2017 x86_64
  • Linux
  • Current PHP version: 7.1.12
  • OpenCart Version 2.3.0.2

I have all ready read the documentation array glob ( string $pattern \[, int $flags = 0 \] )

I am 100% sure it is not issue of OpenCart

Community
  • 1
  • 1
Parnit Das
  • 361
  • 3
  • 7
  • 20
  • It may be a OS issue only. See this thread https://github.com/zendframework/zend-stdlib/issues/58 – Tarun Lalwani Jan 22 '18 at 08:23
  • And another link: https://github.com/CachetHQ/Cachet/issues/2586 – JustCarty Jan 22 '18 at 08:34
  • 1
    [TFM](http://php.net/glob): *Note: The `GLOB_BRACE` flag is not available on some non GNU systems, like Solaris.* – deceze Jan 22 '18 at 08:40
  • If the constant is not defined, then it is obviously not supported by your PHP build, regardless of whether the operating system should normally support it. I couldn't say why that would be the case, given that you state that you're running a Linux platform, but it is the case. Possibly you have a custom-built PHP, or your system is missing the necessary libraries, or something like that; I can't really help on the how it happened or how to fix it, but it does seem pretty clear that it's not available on your system. – Simba Jan 22 '18 at 09:26

1 Answers1

6

Since this happened to me as a former happy glob user:

As mentioned in the comments above - GLOB_BRACE is not available in some Operating Systems. For example the popular Alpine Linux - which is heavily used in Docker containers. Alpine Linux uses musl libc instead of GNU libc.

The fix is: Do not use GLOB_BRACE when you want to run your code on for example Alpine Linux.

When you are using the mentioned "OpenCart": There is some movement in form of a PR.

madflow
  • 7,718
  • 3
  • 39
  • 54