When locally exporting a batched XLSX export of Webform submission results on a Drupal 10 site running on PHP 8.1, I'm seeing the following error once I reach the second batch of results:
Error: Typed property Drupal\webform_xlsx_export\Plugin\WebformExporter\XlsxExporter::$xls must not be accessed before initialization in Drupal\webform_xlsx_export\Plugin\WebformExporter\XlsxExporter->openExport() (line 84 of modules/contrib/webform_xlsx_export/src/Plugin/WebformExporter/XlsxExporter.php).
From reading a couple similar issues in other modules (#3439309: Typed property must not be accessed before initialisation, #3351434: Typed property must not be accessed before initialisation), this can be fixed by giving the typed property $xls a default value. In my testing, that appears to fix it for me. MR forthcoming.
Issue fork webform_xlsx_export-3471813
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
kurttrowbridgeComment #4
spokjeThanks, code changes make sense and patched module now works (even with second and beyond batch of results).
Comment #5
linhnm commentedThe MRs work for me. Thanks
Comment #6
gogowitsch commentedI, too, can confirm that the patch in #3 fixed the problem.
Comment #7
idflood commentedI also confirm this merge request fixed the issue.
Comment #10
prudloff commentedI could not reproduce the error but the change seems harmless so I merged it.
Comment #11
prudloff commentedComment #12
prudloff commentedSorry, I read the description too quickly. I can indeed reproduce when forcing a batch and can confirm the patch fixes the error.