When installing Drupal using a non-English language the installation fails after the language selection submit with the following error:
Call to a member function has() on a non-object in /Users/erik/www/drupal8/core/includes/bootstrap.inc on line 902
Steps to reproduce:
- Check out core 8.x
- Create a translations directory: sites/default/files/translations (or sites/mysite/files/translations if you are using an existing sandbox)
- Download the Dutch 7.17 core translation into this directory
- Start the installation the usual way (example.com/install.php)
- Select 'Nederlands' as language
- 'Save an continue'
This error may be related to #1849004: One Service Container To Rule Them All and #1849700: DrupalKernel's container.modules param should contain module filenames, not full namespace paths. It did not exist before the first was committed, and the latter repaired the installation process work for English.
commit 761ac679064e50650e663d562fb5270714818ca4
Author: catch <catch@35733.no-reply.drupal.org>
Date: Thu Nov 29 20:26:37 2012 +0000
Issue #1849004 by chx, xjm: One Service Container To Rule Them All.
commit 522188692156731724b59bcfc06207b5b0d1e3ec
Author: catch <catch@35733.no-reply.drupal.org>
Date: Mon Dec 3 17:20:24 2012 +0000
Issue #1849700 by katbailey, effulgentsia: Fixed DrupalKernel's container.modules param should contain m
This issue is blocking my work on #1848490: Import translations automatically during installation.
Comment | File | Size | Author |
---|---|---|---|
#7 | i-s04b-noerror-2012-12-11_2352.png | 38.63 KB | YesCT |
#7 | i-s05-warning-2012-12-12_0008.png | 87.24 KB | YesCT |
#6 | i-8-s01-2012-12-11_2321.png | 29.79 KB | YesCT |
#6 | i-s02-2012-12-11_2329.png | 40.26 KB | YesCT |
#6 | i-8-s03-2012-12-11_2323.png | 71.83 KB | YesCT |
Comments
Comment #1
effulgentsia CreditAttribution: effulgentsia commentedWhat's happening is that st() is called very early in the install process, by Drupal\Core\Database\Install\Tasks::runTestQuery().
But, in the presence of installing from a translation, st() calls:
- drupal_get_path() which calls drupal_get_filename() which expects drupal_container() to already exist, but it doesn't yet.
- Even if you fix the above with
($container = drupal_container()) && $container->has(...)
, you then run into a problem that st() also calls Gettext::filesToArray() which calls PoStreamReader::open() which calls drupal_realpath() which requires various subsystems to already be bootstrapped in order to deal with file stream wrappers.So, I'm guessing we need to either make runTestQuery() not call st(), or else fix st() to not invoke these various functions when this early in the install process.
Comment #2
chx CreditAttribution: chx commentedConverting runTestQuery to format_string is quite probably quick and easy. It's a whole another question whether we are happy with the nontranslateability of those strings. I think fixing the whole path is better. ($container = drupal_container()) && $container->has(...), is something I wanted to do anyways and
> PoStreamReader::open() which calls drupal_realpath()
Well that looks a particularly bad idea to me, didnt we say to call drupal_realpath only in utmost need? I recall there was an issue saying so. Did it not make into the docs? Looking at the code, fopen(drupal_realpath($this->_uri), 'rb'); wtf is that and why you can't do fopen($this->_uri, 'rb'); ??? fopen supports wrappers just fine.
Comment #3
effulgentsia CreditAttribution: effulgentsia commentedLet's see what bot thinks. The drupal_realpath() was added in #1658842: Introduce a translations:// stream wrapper to access the .po file directory. I added a comment there linking to here.
Comment #4
YesCT CreditAttribution: YesCT commentedComment #5
chx CreditAttribution: chx commentedNow we just need someone to manually test the scenario described in #0 and we are good to go. That is a very easy thing to do because of the high quality report Sutharsan filed so I tag this step Novice. If it fixes the problem , please RTBC.
Comment #6
YesCT CreditAttribution: YesCT commentedwithout the patch:
sudo rm -r sites
git checkout sites
drush -y sql-drop --db-url="mysql://root:root@localhost/d8-patch"
git pull --rebase
git reset --hard
mkdir sites/default/files
mkdir sites/default/files/translations
cd sites/default/files/translations
curl -O http://ftp.drupal.org/files/translations/7.x/drupal/drupal-7.17.nl.po
1. pick nederlands
2. see other language, proceed with install
3. enter db info
4. white screen
I do not get the error "Call to a member function has() on a non-object in /Users/erik/www/drupal8/core/includes/bootstrap.inc on line 902"
but it does white screen!
test the patch
drush sql-drop
cd ../../../..
sudo rm -r sites
git checkout sites
git pull --rebase
git reset --hard
git checkout -b install-1864292-3
curl -O http://drupal.org/files/installer-mi.patch
git apply --index installer-mi.patch
git commit -m "3 patch"
mkdir sites/default/files
mkdir sites/default/files/translations
cd sites/default/files/translations
curl -O http://ftp.drupal.org/files/translations/7.x/drupal/drupal-7.17.nl.po
steps are the same as without the patch for 1. 2. 3.
4. Get different error
at core/install.php?langcode=nl&profile=standard
Next
hmm. test again: maybe a totally new everything? git clone and a new db too?
Comment #7
YesCT CreditAttribution: YesCT commentedthe drush sql-drop I did to test the patch did not drop the tables.
repeated with
drush -y sql-drop --db-url="mysql://root:root@localhost/d8-patch"
and verified the db was empty
install goes same as without the patch for 1. 2. 3.
Then 4. proceeds
5. goes to 100% and then warning
at
core/install.php?langcode=nl&profile=standard
6. install finishes ok.
So manual test result: patch gets the install past the white screen.
Comment #8
YesCT CreditAttribution: YesCT commentedfollow-up
#1864472: Warning when tries to delete English after non-English install, locale_translation_status_delete_languages()
Comment #9
Sutharsan CreditAttribution: Sutharsan commentedPatch tests fine with me too. Code looks sane. Thanks for the quick response!
Comment #10
effulgentsia CreditAttribution: effulgentsia commentedIn #1658842-61: Introduce a translations:// stream wrapper to access the .po file directory, looks like the drupal_realpath() was added because of suspected PHP versions / OS not supporting stream wrappers directly, but PHP's documentation of fopen() states that it supports stream wrappers. So, given that, and the testing above, RTBC.
[Edit: oops, I didn't notice this was already RTBC'd earlier. Thanks!]
Comment #11
catchLooks good. Committed/pushed to 8.x.