What:
Fatal error: Call to a member function get() on a non-object in /media/Projekt/Drupal/drupal/core/includes/bootstrap.inc on line 893
Stack trace:
1. {main}() .../core/install.php:0
2. install_drupal($settings = *uninitialized*) .../core/install.php:36
3. install_begin_request($install_state = *uninitialized*) .../core/includes/install.core.inc:82
4. install_verify_database_settings() .../core/includes/install.core.inc:300
5. install_database_errors($database = *uninitialized*, $settings_file = *uninitialized*) .../core/includes/install.core.inc:931
6. db_run_tasks($driver = *uninitialized*) .../core/includes/install.core.inc:1059
7. Drupal\\Core\\Database\\Install\\Tasks->runTasks() .../core/includes/install.inc:943
8. call_user_func_array(*uninitialized*, *uninitialized*) .../core/lib/Drupal/Core/Database/Install/Tasks.php:136
9. Drupal\\Core\\Database\\Install\\Tasks->runTestQuery($query = *uninitialized*, $pass = *uninitialized*, $fail = *uninitialized*, $fatal = *uninitialized*) .../core/lib/Drupal/Core/Database/Install/Tasks.php:0
10. st($string = *uninitialized*, $args = *uninitialized*, $options = *uninitialized*) .../core/lib/Drupal/Core/Database/Install/Tasks.php:182
11. drupal_get_path($type = *uninitialized*, $name = *uninitialized*) .../core/includes/install.inc:750
12. drupal_get_filename($type = *uninitialized*, $name = *uninitialized*, $filename = *uninitialized*) .../core/includes/common.inc:2363
When/Where/Why:
Submission of second installation step, after picking any non-English language Drupal has auto-detected and offers to install.
The installation code attempts to check that a database has been set up and is configured with the correct permissions.
The installation task reports a runTestQuery()
pass or fail using a translatable string, passing it via st()
.
Then st()
detects that $install_state['parameters']['langcode']
has been set, installs the appropriate language and attempts to register the locale classes.
To do that it needs the path to the locale module, so it invokes drupal_get_path()
, and ends up calling drupal_get_filename()
.
That function was changed in #1331486-249: Move module_invoke_*() and friends to an Extensions class to utilize drupal_container()->get('module_handler')->getModuleList();
.
At this stage, the Drupal Kernel hasn't yet booted - which only happens once the database is verified to be up - and drupal_container()
returns null.
Consequence:
Drupal cannot be installed with any language other than English.
Fix:
The function drupal_get_filename()
already contains a check which makes sure drupal_container()
returns something useful before trying to use other services.
Let's move the module list lookup inside that check. See patch in comment.
Other notes:
This problem is not caught by the testbot because it only performs a real installation using English. Would it be possible to set up a non-English? (Randomized language?)
I found no way to reproduce the exact same situation using regular tests, since the static in drupal_container()
can't be reset back to null. One could perhaps temporarily replace the keyvalue service with FALSE
instead, to make the second check on the same line in drupal_get_filename()
fail and make it fall through to scanning the filesystem directlty. That would however miss the point of there being no container at all at that stage.
Comment | File | Size | Author |
---|---|---|---|
#1 | drupal-get-filename.1898236.1.patch | 1.3 KB | TwoD |
Comments
Comment #1
TwoDAnd here's the patch.
Comment #2
jthorson CreditAttribution: jthorson commentedSounds like a critical to me. :(
Comment #3
plachI'd say this is major, since there should be a workaround: you can install the system in English and then import the translations. Thus this does not render the system unusable.
However I'm not completely sure, feel free to revert.
Comment #4
webchickBlah. :(
Don't suppose it's possible to add tests for this?
Comment #5
xjmIt's like we have a sign at the door that says "All languages welcome!" and then we slam the door in our non-anglophone guests' faces. :P
It's not currently possible to add a functional test since #630446: Allow SimpleTest to test the non-interactive installer has been sitting in the corner sipping absinthe for the past three years, but maybe we could add a unitish test for
drupal_get_filename()
covering the case where the container is NULL? Is there a way to mock that in a test? It seems like like we've had a lot of nasty bugs from container data being missing.Comment #6
xjmNovice task: Try to install Drupal in a language other than English, as described in the summary, and confirm the bug. Then, apply the patch in #1, and confirm the issue is resolved.
Comment #7
Gábor HojtsyPut on D8MI list for tracking.
Comment #8
nagwani CreditAttribution: nagwani commentedTested the patch #1 based on instructions in #6. Seems to be working
Comment #9
TwoDRe @xjm, #5: I tried to find a way, but while
drupal_container()
does allow one to override the container with another object implementing the interface, it's not possible to remove it completely. A dummy class implementing the same interface won't trigger the same fatal error either.But maybe if Drupal initialized the static to that dummy class, rather than null, we could throw aNever mind, the information we could get out of that wouldn't be much different than a Fatal Error anyway.NoRealContainerSetException
when accessing any of its methods? It would almost be like a built-in test, but we'd have a very shortlived instance on our hands.Re #6: To be able to attempt another install, you also need to remove the test table created just prior to the crash, or use a different db, of course.
I'm leaning towards Critical on this (sorry, forgot to set it) since Drupal "wants" me to install using my language by auto-selecting a specific option for the only setting available on the first page, and then just blows up because of that. Installing the language later as a workaround does work though...
Comment #10
sunThanks!
Comment #11
webchickCool, thanks a lot for looking into it anyway.
Committed and pushed to 8.x. Thanks!
Comment #12
YesCT CreditAttribution: YesCT commentedupdating tags.
Do we want a follow-up issue for tests for #5