When installing Drupal 8 in the Dutch language, i get the following error message:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_picture_target_id' cannot be null: INSERT INTO {user__user_picture} (entity_id, revision_id, bundle, delta, langcode, user_picture_target_id, user_picture_alt, user_picture_title, user_picture_width, user_picture_height) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => user [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => und [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => )
Installation details:
- Language: Dutch. If I install in English, no errors. Therefore tagging with D8MI.
- Standard profile.
- Step where this error occurs: "Site instellen" (Configure site), when pressing "Save and Continue" (after having filled in the details for the "Site maintenance account").
Comment | File | Size | Author |
---|---|---|---|
#22 | install_foreign_language-2091523-22-test-only.patch | 905 bytes | yched |
#22 | install_foreign_language-2091523-22.patch | 2.51 KB | yched |
#17 | install_foreign_language-2091523-17.patch | 2.51 KB | pfrenssen |
#14 | install_foreign_language-2091523-14.patch | 2.52 KB | yched |
#14 | interdiff.txt | 920 bytes | yched |
Comments
Comment #1
Sutharsan CreditAttribution: Sutharsan commentedSame error observed with installation in German. Git checkout after: Tue Sep 17 10:12:09 2013 +0100
Comment #2
eigentor CreditAttribution: eigentor commentedConfirmed after trying to install Head on simplytest.me in german.
Comment #3
fietserwinSome debugging:
File drupal\core\lib\Drupal\Core\Entity\DatabaseStorageController.php
Method: doSaveFieldItems
The User entity passed in does not have a field user_picture, but after executing the $entity->getTranslation($langcode)->{$field_name} part, there is a 'user_picture' entry in the fields property. So _get()ing a {field_name} creates one if it does not yet exist (I guess it has to, otherwise getValue() will fail).
(Simple) solutions (for this problem:
- Have the property {field_name} on an entity return NULL and split the statement
- First check if the field is set, before getting it and also continue if not set
- Have getValue() return something that evaluates to !isset
- Have getValue() return something that evaluates to empty and change the check below
File: drupal\core\lib\Drupal\Core\Entity\Field\Field.php
To have getValue() return something that evaluates to empty or !isset we could first do the $item->getValue(...) and only add that to the $values array if it is not empty . But fields already do so at a higher level using their isEmpty() method. Why not here?
Notes:
- This was just some thinking out loud, but as we are so deep in the "entity field kernel" here, I cannot oversee the impact of any of the above suggested changes.
- I also do not understand, if it is indeed flawed at this level, why it would only be discovered now and only during install.
- Nor do I understand why it does not occur in English. I thought that English was now just one of the languages and not special anymore.
Comment #4
bserem CreditAttribution: bserem commentedIt seems that the issue appears on all languages except from English.
Comment #5
Gábor HojtsyElevating to critical because you cannot install Drupal 8 in a foreign language anymore.
Comment #6
NITEMAN CreditAttribution: NITEMAN commentedIt seems that the problem is in the user_picture field attachment.
Also, it doesn't fail with minimal profile (because it doesn't have the field).
Comment #7
yched CreditAttribution: yched commentedCrossposting the folks in #1983554: Remove BC-mode from EntityNG .
Temptative patch, might break other stuff.
Also, let's try to have the installation of 'standard' profile in a non-english language tested (current test only tests the 'default' profile)
Comment #8
penyaskitoStill failing with:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'user_picture_target_id' cannot be null: INSERT INTO {user__user_picture} (entity_id, revision_id, bundle, delta, langcode, user_picture_target_id, user_picture_alt, user_picture_title, user_picture_width, user_picture_height) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => user [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => und [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => )
Comment #9
yched CreditAttribution: yched commentedThanks for testing :-)
How about this ?
Comment #10
mikispeed CreditAttribution: mikispeed commentedWhen testing patch from #9 I get:
Warning: Invalid argument supplied for foreach() in Drupal\Core\Entity\DatabaseStorageController->doSaveFieldItems() (line 658 of core/lib/Drupal/Core/Entity/DatabaseStorageController.php)
and install finishes this time.
Comment #11
penyaskitoWhen updating config translations, I get a warning:
Warning: Invalid argument supplied for foreach() in Drupal\Core\Entity\DatabaseStorageController->doSaveFieldItems() (line 658 of core/lib/Drupal/Core/Entity/DatabaseStorageController.php).
But at the end, Drupal is installed with a foreign language. Yay!!
Comment #13
marthinal CreditAttribution: marthinal commented#9: install_foreign_language-2091523-9.patch queued for re-testing.
Comment #14
yched CreditAttribution: yched commentedSilly me. filterEmptyValues() has no return value.
Comment #15
penyaskito#14 works like a charm, manually tested it. I didn't run the tests, so waiting for results before RTBCing.
Comment #16
pfrenssenThe parentheses around the !empty() are not needed.
Comment #17
pfrenssenFixed my little niggle from #16.
Interdiff:
Comment #19
marthinal CreditAttribution: marthinal commentedComment #20
penyaskitoTested this installing in Spanish and works like a charm.
@pfrenssen, please, next time you could provide interdiffs that makes easier to review: https://drupal.org/node/1488712. Thanks for the nitpick and the patch!
Comment #21
pfrenssen@penyaskito, you're right I forgot to include the interdiff, I've now pasted it in my comment #17. Thanks!
Comment #22
yched CreditAttribution: yched commentedJust re-uploading with a test-only patch to make sure that the test catches the failure.
Comment #23
catchCommitted/pushed to 8.x, thanks!
Comment #25
Gábor HojtsySuperb, thanks!