Hi,
When exporting certain webforms we're receiving the following fatal error during the batch process:
Recoverable fatal error: Object of class stdClass could not be converted to string in webform_exporter_excel_xlsx->add_row() (line 27 of /vagrant/docroot/sites/all/modules/webform/includes/exporters/webform_exporter_excel_xlsx.inc).
Upon further review this is caused by:
$value = preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', '', $value);
As there are some "values" that are arrays and objects. Notably the foreach loop kept failing when the current value is the node object of the node related to the webform.
Are node objects normally passed in the $data array? Or is this something we're not doing correctly?
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | webform-fix-fatal-error-excel-2810653-9.patch | 3.03 KB | nicxvan |
| #2 | webform-2810653-2.patch | 7.27 KB | pifagor |
Issue fork webform-2810653
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pifagorcheck patch
Comment #3
nathandentzauI don't think a complete refactor of this class is required. We can leverage some OOP principles here. See my patch.
Comment #4
liam morlandWhy not just put an if statement around the preg_replace() instead of making a new method?
Even with this patch, when the $value is added to $output, there will be an object or array to string conversion, so I think the error will still happen
What are the steps to reproduce this problem? Is anyone else seeing this?
Comment #5
liam morlandShould "UTF-A" be "UTF-8"?
Comment #6
pifagor@Liam Morland
Look this, please
https://www.drupal.org/files/issues/webform-2810653-2.patch
Comment #8
liam morlandThanks for the patches.
@pifagor Your patch needs to be re-rolled so that it applies and passes testing. Can you explain why you prefer it to the approach in #3?
@nathandentzau If you would like your patch to move ahead, please reply to the comments I made about it.
Comment #9
nicxvan commentedReroll for 4.23
Comment #12
liam morlandDrupal 7 is no longer supported. If this applies to a supported version, please re-open.