error later when answering a question

Created on 27 January 2022, over 2 years ago
Updated 15 November 2023, 8 months ago

Problem/Motivation

When resolve a activity of type: Dragn and Drop and and click next I have the following error

Steps to reproduce

The website encountered an unexpected error. Please try again later.

Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_correct_response_value' at row 1: INSERT INTO {opigno_answer__field_correct_response} (entity_id, revision_id, bundle, delta, langcode, field_correct_response_value) 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); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => opigno_h5p [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => en [:db_insert_placeholder_5] => 0[.]0[,]0[.]4[,]0[.]8[,]0[.]10[,]1[.]4[,]1[.]8[,]1[.]10[,]1[.]0[,]2[.]8[,]2[.]10[,]2[.]0[,]2[.]4[,]3[.]10[,]3[.]8[,]3[.]0[,]3[.]4[,]4[.]1[,]4[.]5[,]5[.]5[,]5[.]1[,]6[.]2[,]7[.]6[,]8[.]3[,]8[.]7[,]8[.]9[,]9[.]7[,]9[.]3[,]9[.]9[,]10[.]9[,]11[.]11[,]11[.]3[,]11[.]7 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Database\Statement->execute(Array, Array) (Line: 640)
Drupal\Core\Database\Connection->query('INSERT INTO {opigno_answer__field_correct_response} (entity_id, revision_id, bundle, delta, langcode, field_correct_response_value) 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)', Array, Array) (Line: 357)
Drupal\Core\Database\Driver\mysql\Connection->query('INSERT INTO {opigno_answer__field_correct_response} (entity_id, revision_id, bundle, delta, langcode, field_correct_response_value) 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)', Array, Array) (Line: 32)
Drupal\Core\Database\Driver\mysql\Insert->execute() (Line: 1414)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->saveToDedicatedTables(Object, 1, Array) (Line: 996)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->doSaveFieldItems(Object) (Line: 665)
Drupal\Core\Entity\ContentEntityStorageBase->doSave('1', Object) (Line: 457)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 837)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 395)
Drupal\Core\Entity\EntityBase->save() (Line: 52)
_opigno_h5_form_submit(Array, Object)
call_user_func_array('_opigno_h5_form_submit', Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('opigno_answer_opigno_h5p_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 61)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 644)
Drupal\opigno_module\Controller\OpignoModuleController->moduleQuestionAnswerForm(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

I think it's because 'max_length' characters, I've applied this patch https://www.drupal.org/files/issues/2020-04-15/3035615-9.patch β†’ but my problem is in a response and not in question.

I've attached the problem and h5p example

πŸ› Bug report
Status

Active

Version

2.18

Component

Code

Created by

πŸ‡¬πŸ‡ΉGuatemala isimgt

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡΄Bolivia vacho Cochabamba

    The solution should be change Text (plain) type for a Text (plain, long) because this field suport this kindo of content: Eau[,]Energie[,]Energie[,]Energie[,]PΓ©age[,]Carburant[,]Telecom[,]Telecom[,]Energie[,]Carburant[,]Carburant[,]Telecom[,]Telecom where into a text is all the options, in some order. So can be more than 255

  • πŸ‡§πŸ‡΄Bolivia vacho Cochabamba

    After review in deep change to text (plain, long) isn't needed. Text (plain) support in my case the characters that I needed.

  • πŸ‡§πŸ‡΄Bolivia vacho Cochabamba

    should be close in favor of https://www.drupal.org/project/opigno_module/issues/3401907 πŸ› opigno_answer__field_correct_response is short in some cases Active

Production build 0.69.0 2024