Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293938

Uncaught exception SplFileInfo::openFile during installation on Windows when the Drupal root directory is greater than 88 characters

$
0
0

Problem/Motivation

Discovered as part of #2606772: Long Twig cache directories can cause failures on some filesystems.

On all Windows machines, some encrypted Linux filesystems, and some Docker configurations there is a max path limit of 255 chars. If $settings['extension_discovery_scan_tests'] = TRUE, which is part of the default settings.local.php file, Drupal will throw an uncaught exception when trying to read invalid_module_name_over_the_maximum_allowed_character_length.info.yml if the Drupal root directory is greater than 88 characters. This comes at the very beginning of the install process so the user is not warned by the error added in #2606772: Long Twig cache directories can cause failures on some filesystems.

The work-around is to set extension_discovery_scan_tests to FALSE.

Full error message:

RuntimeException: SplFileInfo::openFile(C:\Users\Mike\Documents\dev\drupal-core\123456789-123456789-123456789-123456789-123456789-123456789-1/core/modules/system/tests/modules/invalid_module_name_over_the_maximum_allowed_character_length/invalid_module_name_over_the_maximum_allowed_character_length.info.yml): failed to open stream: Invalid argument in SplFileInfo->openFile() (line 458 of C:\Users\Mike\Documents\dev\drupal-core\123456789-123456789-123456789-123456789-123456789-123456789-1\core\lib\Drupal\Core\Extension\ExtensionDiscovery.php).

SplFileInfo->openFile('r') (Line: 458)
Drupal\Core\Extension\ExtensionDiscovery->scanDirectory('core', 1) (Line: 205)
Drupal\Core\Extension\ExtensionDiscovery->scan('module') (Line: 170)
Drupal\Core\Config\InstallStorage->getAllFolders() (Line: 95)
Drupal\Core\Config\InstallStorage->exists('core.extension') (Line: 103)
Drupal\Core\Config\FileStorage->read('core.extension') (Line: 130)
Drupal\Core\Config\FileStorage->readMultiple(Array) (Line: 165)
Drupal\Core\Config\ConfigFactory->doLoadMultiple(Array, 1) (Line: 104)
Drupal\Core\Config\ConfigFactory->doGet('core.extension') (Line: 89)
Drupal\Core\Config\ConfigFactory->get('core.extension') (Line: 220)
Drupal\Core\Extension\ThemeHandler->refreshInfo() (Line: 186)
Drupal\Core\Extension\ThemeHandler->listInfo() (Line: 65)
_drupal_maintenance_theme() (Line: 709)
drupal_maintenance_theme() (Line: 965)
install_display_output(Array, Array, Array) (Line: 264)
_drupal_log_error(Array, 1) (Line: 569)
_drupal_exception_handler(Object)

Steps to reproduce

  • Create a webroot so that the absolute path to the root folder is more than 88 characters long.
  • Put Drupal in that path
  • Set $settings['extension_discovery_scan_tests'] = TRUE
  • Attempt to install

Proposed resolution

Catch the Exception and show a useful warning.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 293938

Trending Articles