Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#6 | installer-settings-not-readable-1542620-6.patch | 2.64 KB | ParisLiakos |
#3 | installer-settings-not-readable-1542620-3.patch | 2.78 KB | djdevin |
Comments
Comment #1
DamienMcKennaAt what stage of the installation did the error occur?
Comment #2
hefox CreditAttribution: hefox commentedYou 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)
Comment #3
djdevinThis 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.
Comment #4
hefox CreditAttribution: hefox commentedHaven'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.
Comment #5
djdevinI 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.
Comment #6
ParisLiakos CreditAttribution: ParisLiakos commentedPatch no longer applies so i rerolled it.
But it solves the problem indeed:)
rtbc
Comment #7
catchLooks reasonable to me. Committed/pushed to 8.x.
Comment #9
David_Rothstein CreditAttribution: David_Rothstein commentedNot 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.