Problem/Motivation

WSOD when trying to export content if site uuid is not set (PHP 8.3.29)

Steps to reproduce

- clean Drupal installation, unset site uuid
- enable single content sync, disable site uuid check
- navigate to Export on any content

Following error:
The website encountered an unexpected error. Try again later.

TypeError: Drupal\single_content_sync\ContentSyncHelper::getSiteUuid(): Return value must be of type string, null returned in Drupal\single_content_sync\ContentSyncHelper->getSiteUuid() (line 253 of modules/contrib/single_content_sync/src/ContentSyncHelper.php).
Drupal\single_content_sync\ContentExporter->doExportToYml(Object, ) (Line: 98)
Drupal\single_content_sync\Form\ContentExportForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('single_content_sync_export_form', Object) (Line: 284)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)

Proposed resolution

Allow NULL in public function getSiteUuid(): string;

Remaining tasks

update code

User interface changes

none

API changes

modify ContentSyncHelperInterface to allow nullable public function getSiteUuid(): string;

Data model changes

none

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

jannakha created an issue. See original summary.

jannakha’s picture

Issue summary: View changes
jannakha’s picture

Status: Active » Needs review

MR 183 ready for review
simple change: make site uuid nullable

In export yml: site_uuid: null, export/import works without any issues.

jannakha’s picture

Status: Needs review » Reviewed & tested by the community

Ready for review

jannakha’s picture

Status: Reviewed & tested by the community » Needs review
vladimiraus’s picture

Status: Needs review » Reviewed & tested by the community

Looks great and applies.
Thank you for your contribution. 🍻

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

nginex’s picture

Status: Reviewed & tested by the community » Fixed

thanks for the patch

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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