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
Issue fork single_content_sync-3573737
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 #3
jannakha commentedComment #4
jannakha commentedMR 183 ready for review
simple change: make site uuid nullable
In export yml:
site_uuid: null, export/import works without any issues.Comment #5
jannakha commentedReady for review
Comment #6
jannakha commentedComment #7
vladimirausLooks great and applies.
Thank you for your contribution. 🍻
Comment #10
nginex commentedthanks for the patch