To reproduce, do: chmod -r sites/default/settings.php (permissions get set to --wx-wx-wx)

core/install.php: Fatal error: Call to undefined function theme() in ../drupal/core/includes/install.core.inc on line 745
Other places: Fatal error: Class 'Symfony\Component\DependencyInjection\ContainerBuilder' not found in ../drupal/core/includes/bootstrap.inc on line 2335

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

At what stage of the installation did the error occur?

hefox’s picture

You can do it anytime; when nothing is set up, or even a fully installed copy drupal (I originally got it when installing, then after fixed it went and tested again and same error)

djdevin’s picture

Status: Active » Needs review
FileSize
2.78 KB

This probably won't happen too often, but definitely reproducable and I could see a case where a machine has permission defaults of owner-only and the webserver user is another account. However silly, this will also handle a file set to write-only and no read.

I changed a file_exists() to is_readable() (to fix the runtime error) and split up the read/write requirement check into two separate checks for the installer. I'm not sure if there's a better way to throw an exception gracefully this early in the bootstrap.

hefox’s picture

Haven't tested it yet, but looks like it'd solve it.

Considering it's bootstrap, looking into alternates that may be faster. The quick thought was require_once instead of include_once (whether require_once is better than is_readable, no idea). Based on reading the include-once php.net, "If the file can't be included, FALSE is returned and E_WARNING is issued.", so could do something with that.

djdevin’s picture

I think that's the root issue - the E_WARNING is getting triggered from the include_once failing, but by that time Drupal has already registered its own error handler which doesn't seem to be fully available at the time of the error - so it fatals out.

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
2.64 KB

Patch no longer applies so i rerolled it.
But it solves the problem indeed:)

rtbc

catch’s picture

Status: Reviewed & tested by the community » Fixed

Looks reasonable to me. Committed/pushed to 8.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

David_Rothstein’s picture

Not sure if anyone wants to backport this to Drupal 7 at some point (in theory I'd guess the bug exists there too?). But if so, please note the followup in #1805324: Installer does not verify readability of settings.php.