Undefined constant GLOB_BRACE inside docker container

Created on 12 January 2023, almost 2 years ago
Updated 12 September 2024, 2 months ago

According to this https://stackoverflow.com/a/58287388 and this https://github.com/docker-library/php/issues/719 sources, the GLOB_BRACE const doesn't work on the some Linux OS such as Alpine and also doesn't work inside the docker containers under Alpine like the docker4drupal.

docker4drupal - 5.4.3
docker - version 20.10.22, build 3a2c30b
docker-compose - v2.14.1
PHP - 8.0-4.38.0

Trace -

The website encountered an unexpected error. Please try again later.
Error: Undefined constant "Drupal\media_library_importer\Form\GLOB_BRACE" in Drupal\media_library_importer\Form\ImportForm->getMediaFolders() (line 317 of modules/contrib/media_library_importer/src/Form/ImportForm.php).
Drupal\media_library_importer\Form\ImportForm->getMediaFolders() (Line: 99)
Drupal\media_library_importer\Form\ImportForm->buildForm()
call_user_func_array() (Line: 531)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 278)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)
🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇺🇦Ukraine _bit Lutsk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada puregin

    I have been seeing the same issue (with version 2.0.0-beta1, Drupal core 9.5.7, PHP 8.1, running an Alpine based PHP-FPM).

    I've worked around this by using \Laminas\Stdlib\Glob::glob() . I will supply a patch later today.

  • 🇨🇦Canada puregin

    I'm setting the priority of this to "Major" as it affects only deployments using specific docker images, and its effects are limited to the functionality supplied by this module.

  • Status changed to Needs review over 1 year ago
  • Status changed to Closed: works as designed 8 months ago
  • 🇮🇹Italy itamair

    Thanks for reporting this,
    BUT the GLOB_BRACE is an official parameter for the PHP glob() function.

    Users experiencing this issue should rather switch to version of their PHP docker container that properly support that ...
    rather than this Drupal module introduce a new dependency from a third party PHP library (that in your MR is not even properly required by the internal module composer.json).

    Closing this as "works as designed".

  • Status changed to Needs review 2 months ago
  • 🇨🇦Canada puregin

    I'll update the patch to require the dependency via composer.

Production build 0.71.5 2024