- Issue created by @jlscott
- @jlscott opened merge request.
I am getting the following error when trying to process a number of view results through vbo_export.
Error: Typed property Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase::$view must not be accessed before initialization in Drupal\vbo_export\Plugin\Action\VboExportBase->setHeader() (line 312 of /code/web/modules/contrib/vbo_export/src/Plugin/Action/VboExportBase.php)
When typed properties were introduced into classes in Php7.4, it became essential to initialise them before they were accessed. This is usually done in the class constructor, but it can be done by specifying a default value in the class where the property is defined.
The typed property protected ViewExecutable $view;
in class \Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase is not initialised in the constructor (of final class Drupal\vbo_export\Pugin\Action\VboExportXlsx nor its parents). This gives the potential for the error if the property is accessed before it is set, which is happening in my case.
To avoid this problem, it would be useful to assign a default value to the typed property in the class ViewsBulkOperationsActionBase where it is defined. This could be done with a statement like:
protected ?ViewExecutable $view = NULL;
This looks like it is related to the issue 🐛 VBO 4 doesn't process every selected node Fixed .
Active
4.2
Actions