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.

Command icon 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

kurttrowbridge created an issue. See original summary.

kurttrowbridge’s picture

Title: Typed property must not be accessed before initialisation » Typed property must not be accessed before initialization
Status: Active » Needs review

spokje’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, code changes make sense and patched module now works (even with second and beyond batch of results).

linhnm’s picture

The MRs work for me. Thanks

gogowitsch’s picture

I, too, can confirm that the patch in #3 fixed the problem.

idflood’s picture

I also confirm this merge request fixed the issue.

prudloff made their first commit to this issue’s fork.

prudloff’s picture

Status: Reviewed & tested by the community » Fixed

I could not reproduce the error but the change seems harmless so I merged it.

prudloff’s picture

prudloff’s picture

Sorry, I read the description too quickly. I can indeed reproduce when forcing a batch and can confirm the patch fixes the error.

Status: Fixed » Closed (fixed)

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