csv/html-Export failed:

E_NOTICE: Array to string conversion /.../modules/webform/src/Plugin/WebformExporter/DelimitedWebformExporter.php 104
Callstack:
-> fputcsv(resource { ... }, array(32) { ... }, ',')
-> Drupal\webform\Plugin\WebformExporter\DelimitedWebformExporter::writeSubmission(Drupal\webform\Entity\WebformSubmission(...) { ... })
-> Drupal\webform\WebformSubmissionExporter::writeRecords(array(19) { ... })
-> Drupal\webform\Controller\WebformResultsExportController::batchProcess(Drupal\webform\Entity\Webform(...) { ... }, NULL, array(24) { ... }, DrushBatchContext(...) { ... })
-> _drush_batch_worker()
-> _drush_batch_command('5696')
-> drush_batch_command('5696')
-> drush_core_batch_process('5696')
-> _drush_invoke_hooks(array(37) { ... }, array(1) { ... })
-> drush_command('5696')
-> drush_dispatch(array(37) { ... })
-> Drush\Boot\BaseBoot::bootstrap_and_dispatch()
-> drush_main()
-> require('phar:///us...')

Drush command terminated abnormally due to an unrecoverable error.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

poldrack created an issue. See original summary.

jrockowitz’s picture

Status: Active » Postponed (maintainer needs more info)

Please export and upload an example of a webform that is having problems being exported.

poldrack’s picture

stdClass Object
(
[__CLASS__] => Drupal\webform\Entity\Webform
[id:protected] => webform_test
[uuid:protected] => ac6e368b-5633-434d-b99b-56cc4adb3fe7
[override:protected] =>
[status:protected] => open
[open:protected] =>
[close:protected] =>
[template:protected] =>
[title:protected] => Webform-Test
[description:protected] => Testformular zum austesten.
[category:protected] =>
[uid:protected] => 1
[settings:protected] => Array
(
[ajax] =>
[ajax_scroll_top] => form
[page] => 1
[page_submit_path] =>
[page_confirm_path] =>
[form_submit_once] =>
[form_exception_message] =>
[form_open_message] =>
[form_close_message] =>
[form_previous_submissions] => 1
[form_confidential] =>
[form_confidential_message] =>
[form_convert_anonymous] =>
[form_prepopulate] =>
[form_prepopulate_source_entity] =>
[form_prepopulate_source_entity_required] =>
[form_prepopulate_source_entity_type] =>
[form_reset] =>
[form_disable_autocomplete] =>
[form_novalidate] =>
[form_unsaved] =>
[form_disable_back] =>
[form_autofocus] =>
[form_details_toggle] =>
[submission_label] =>
[submission_log] =>
[submission_user_columns] => Array
(
)

[wizard_progress_bar] => 1
[wizard_progress_pages] =>
[wizard_progress_percentage] =>
[wizard_start_label] =>
[wizard_confirmation] => 1
[wizard_confirmation_label] =>
[wizard_track] =>
[preview] => 0
[preview_label] =>
[preview_title] =>
[preview_message] =>
[preview_attributes] => Array
(
)

[preview_excluded_elements] => Array
(
)

[preview_exclude_empty] => 1
[draft] => none
[draft_multiple] =>
[draft_auto_save] =>
[draft_saved_message] =>
[draft_loaded_message] =>
[confirmation_type] => page
[confirmation_title] =>
[confirmation_message] =>
[confirmation_url] =>
[confirmation_attributes] => Array
(
)

[confirmation_back] => 1
[confirmation_back_label] =>
[confirmation_back_attributes] => Array
(
)

[limit_total] =>
[limit_total_message] =>
[limit_user] =>
[limit_user_message] =>
[purge] => none
[purge_days] =>
[entity_limit_total] =>
[entity_limit_user] =>
[results_disabled] =>
[results_disabled_ignore] =>
[token_update] =>
[wizard_comfirmation] => 1
[wizard_comfirmation_label] =>
)

[access:protected] => Array
(
[create] => Array
(
[roles] => Array
(
[0] => anonymous
[1] => authenticated
)

[users] => Array
(
)

[permissions] => Array
(
)

)

[view_any] => Array
(
[roles] => Array
(
)

[users] => Array
(
)

[permissions] => Array
(
)

)

[update_any] => Array
(
[roles] => Array
(
)

[users] => Array
(
)

[permissions] => Array
(
)

)

[delete_any] => Array
(
[roles] => Array
(
)

[users] => Array
(
)

[permissions] => Array
(
)

)

[purge_any] => Array
(
[roles] => Array
(
)

[users] => Array
(
)

[permissions] => Array
(
)

)

[view_own] => Array
(
[roles] => Array
(
)

[users] => Array
(
)

[permissions] => Array
(
)

)

[update_own] => Array
(
[roles] => Array
(
)

[users] => Array
(
)

[permissions] => Array
(
)

)

[delete_own] => Array
(
[roles] => Array
(
)

[users] => Array
(
)

[permissions] => Array
(
)

)

)

[elements:protected] => einleitung:
'#type': processed_text
'#text': "

Das zur Einleitung
\r\n"
'#format': full_html
text:
'#type': textfield
'#title': text
textbereich:
'#type': textarea
'#title': textbereich

[css:protected] =>
[javascript:protected] =>
[handlers:protected] => Array
(
)

[handlersCollection:protected] =>
[elementsOriginal:protected] => einleitung:
'#type': processed_text
'#text': "

Das zur Einleitung
\r\n"
'#format': full_html
text:
'#type': textfield
'#title': text
textbereich:
'#type': textarea
'#title': textbereich

[elementsDecoded:protected] =>
[elementsInitialized:protected] =>
[elementsDecodedAndFlattened:protected] =>
[elementsInitializedAndFlattened:protected] =>
[elementsInitializedFlattenedAndHasValue:protected] =>
[elementsTranslations:protected] =>
[elementsActions:protected] => Array
(
)

[elementsWizardPages:protected] => Array
(
)

[pages:protected] =>
[hasManagedFile:protected] =>
[hasFlexboxLayout:protected] =>
[hasContainer:protected] =>
[hasConditions:protected] =>
[hasTranslations:protected] =>
[originalId:protected] => webform_test
[langcode:protected] => de
[third_party_settings:protected] => Array
(
)

[_core:protected] => Array
(
)

[trustedData:protected] =>
[entityTypeId:protected] => webform
[enforceIsNew:protected] =>
[typedData:protected] =>
[cacheContexts:protected] => Array
(
[0] => languages:language_interface
)

[cacheTags:protected] => Array
(
)

[cacheMaxAge:protected] => -1
[_serviceIds:protected] => Array
(
)

[dependencies:protected] => Array
(
)

[stringTranslation:protected] =>
[isSyncing:Drupal\Core\Config\Entity\ConfigEntityBase:private] =>
[isUninstalling:Drupal\Core\Config\Entity\ConfigEntityBase:private] =>
)

jrockowitz’s picture

Please export the YAML configuration file for the webform and upload it here.

poldrack’s picture

langcode: de
status: open
dependencies: { }
open: null
close: null
uid: 1
template: false
id: webform_test
title: Webform-Test
description: 'Testformular zum austesten.'
category: ''
elements: "einleitung:\n '#type': processed_text\n '#text': \"

Das zur Einleitung

\\r\\n\"\n '#format': full_html\n text:\n '#type': textfield\n '#title': text\n textbereich:\n '#type': textarea\n '#title': textbereich\n"
css: ''
javascript: ''
settings:
ajax: false
ajax_scroll_top: form
page: true
page_submit_path: ''
page_confirm_path: ''
form_submit_once: false
form_exception_message: ''
form_open_message: ''
form_close_message: ''
form_previous_submissions: true
form_confidential: false
form_confidential_message: ''
form_convert_anonymous: false
form_prepopulate: false
form_prepopulate_source_entity: false
form_prepopulate_source_entity_required: false
form_prepopulate_source_entity_type: ''
form_reset: false
form_disable_autocomplete: false
form_novalidate: false
form_unsaved: false
form_disable_back: false
form_autofocus: false
form_details_toggle: false
submission_label: ''
submission_log: false
submission_user_columns: { }
wizard_progress_bar: true
wizard_progress_pages: false
wizard_progress_percentage: false
wizard_start_label: ''
wizard_confirmation: true
wizard_confirmation_label: ''
wizard_track: ''
preview: 0
preview_label: ''
preview_title: ''
preview_message: ''
preview_attributes: { }
preview_excluded_elements: { }
preview_exclude_empty: true
draft: none
draft_multiple: false
draft_auto_save: false
draft_saved_message: ''
draft_loaded_message: ''
confirmation_type: page
confirmation_title: ''
confirmation_message: ''
confirmation_url: ''
confirmation_attributes: { }
confirmation_back: true
confirmation_back_label: ''
confirmation_back_attributes: { }
limit_total: null
limit_total_message: ''
limit_user: null
limit_user_message: ''
purge: none
purge_days: null
entity_limit_total: null
entity_limit_user: null
results_disabled: false
results_disabled_ignore: false
token_update: false
wizard_comfirmation: true
wizard_comfirmation_label: ''
access:
create:
roles:
- anonymous
- authenticated
users: { }
permissions: { }
view_any:
roles: { }
users: { }
permissions: { }
update_any:
roles: { }
users: { }
permissions: { }
delete_any:
roles: { }
users: { }
permissions: { }
purge_any:
roles: { }
users: { }
permissions: { }
view_own:
roles: { }
users: { }
permissions: { }
update_own:
roles: { }
users: { }
permissions: { }
delete_own:
roles: { }
users: { }
permissions: { }
handlers: { }
uuid: ac6e368b-5633-434d-b99b-56cc4adb3fe7

poldrack’s picture

Status: Postponed (maintainer needs more info) » Needs work

Do you have a suggestion fix the problem?

Thx you :-)

jrockowitz’s picture

I suspect the processed_text element is causing the issue.

Right now, I don't have time to fix this problem.

jrockowitz’s picture

Status: Needs work » Needs review
FileSize
3.04 KB
866 bytes

The attached form replicated the issue when the CSV is exported using Drush.

#2919721: Error: Call to a member function id() on boolean in .. caused this regression.

The attached patch should fix the issue.

  • jrockowitz committed fd84727 on 8.x-5.x
    Issue #2923119 by jrockowitz: csv/html-Export failed
    
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

poldrack’s picture

Status: Fixed » Needs work

Thank you very much for your work and efforts. Unfortunately, I still get an error message.

I installed webform 8.x-5.0-beta23+58-dev (2017-Nov-24) und run the update.php. The export function still has a failer.

E_NOTICE: Array to string conversion ../modules/contrib/webform/src/Plugin/WebformExporter/DelimitedWebformExporter.php 104
Callstack:
-> fputcsv(resource { ... }, array(22) { ... }, ',')
-> Drupal\webform\Plugin\WebformExporter\DelimitedWebformExporter::writeSubmission(Drupal\webform\Entity\WebformSubmission(...) { ... })
-> Drupal\webform\WebformSubmissionExporter::writeRecords(array(1) { ... })
-> Drupal\webform\Controller\WebformResultsExportController::batchProcess(Drupal\webform\Entity\Webform(...) { ... }, NULL, array(21) { ... }, DrushBatchContext(...) { ... })
-> _drush_batch_worker()
-> _drush_batch_command('5972')
-> drush_batch_command('5972')
-> drush_core_batch_process('5972')
-> _drush_invoke_hooks(array(37) { ... }, array(1) { ... })
-> drush_command('5972')
-> drush_dispatch(array(37) { ... })
-> Drush\Boot\BaseBoot::bootstrap_and_dispatch()
-> drush_main()
-> require('phar:///us...')

jrockowitz’s picture

Priority: Critical » Normal

@poldrack Please export and attach a copy of a broken webform with the exact Drush command that you are using.

jrockowitz’s picture

Status: Needs work » Postponed (maintainer needs more info)
albertski’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
786 bytes

I ran into this problem as well, when downloading via UI.

One of the values was returning an array instead of a string which was causing the issue. I was able to figure out which value was causing the issue with this code in TabularBaseWebformExporter::formatRecordFieldDefinitionValue().

default:
  if (is_array($webform_submission->get($field_name)->value)) {
    kint($field_name);
    kint($webform_submission->get($field_name)->value);
  }
  $record[] = $webform_submission->get($field_name)->value;
  break;

The problem field was metatag. Not sure how that was ending up here (FYI I didn't have a field on the form for metatag). I looked at the metatag settings and couldn't figure it out. I couldn't find any calls for metatag in the webforms module so something with metatag and entities that may be causing this.

The attached patch checks if it is an array, and if it is an array just setting it to blank.

jrockowitz’s picture

Hmm... maybe there is a meta tag that is conflicting with a webform submission property or vise-versa.

jrockowitz’s picture

Status: Needs review » Needs work

Okay, as soon as I enable the metatag module I am able to replicate the error. We need to figure why the metatag module is triggering this error.

jrockowitz’s picture

Status: Needs work » Needs review
FileSize
668 bytes

Attached patch removes the 'map' field type from all webform submission definitions.

  • jrockowitz committed 9f0e7cd on 8.x-5.x
    Issue #2923119 by jrockowitz, albertski: csv/html-Export failed
    
jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.