Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: comment must be of type string, null given #3

Open
ep-mo opened this issue Sep 14, 2021 · 0 comments
Open

Uncaught TypeError: comment must be of type string, null given #3

ep-mo opened this issue Sep 14, 2021 · 0 comments

Comments

@ep-mo
Copy link

ep-mo commented Sep 14, 2021

Export fails if comment is NULL. Exporting from ActiveCollab Cloud using PR #1. Not sure how this is possible, maybe comment was deleted from ActiveCollab?

Stack trace:

Uncaught TypeError: ActiveCollabToJiraMigrator\JiraDataObjects\WorklogEntity::__construct(): Argument #2 ($comment) must be of type string, null given, called in /home/migrator/active-collab-to-jira-migrator/src/JiraDataObjects/WorklogEntity.php on line 98 and defined in /home/migrator/active-collab-to-jira-migrator/src/JiraDataObjects/WorklogEntity.php:123
Stack trace:
#0 /home/migrator/active-collab-to-jira-migrator/src/JiraDataObjects/WorklogEntity.php(98): ActiveCollabToJiraMigrator\JiraDataObjects\WorklogEntity->__construct('xx@domain...', NULL, '2020-03-27T00:0...', 'PT1H45M')
#1 /home/migrator/active-collab-to-jira-migrator/src/JiraDataObjects/IssueEntity.php(712): ActiveCollabToJiraMigrator\JiraDataObjects\WorklogEntity::createInstanceFromAcApiArray(Array, Object(ActiveCollabToJiraMigrator\Process\MigrationManager))
#2 /home/migrator/active-collab-to-jira-migrator/src/JiraDataObjects/IssueEntity.php(381): ActiveCollabToJiraMigrator\JiraDataObjects\IssueEntity::buildWorklogsEntities(67, 547, Object(ActiveCollabToJiraMigrator\Process\MigrationManager))
#3 /home/migrator/active-collab-to-jira-migrator/src/JiraDataObjects/ProjectEntity.php(285): ActiveCollabToJiraMigrator\JiraDataObjects\IssueEntity::createInstanceFromAcApiArray(Array, Object(ActiveCollabToJiraMigrator\Process\MigrationManager))
#4 /home/migrator/active-collab-to-jira-migrator/src/JiraDataObjects/ProjectEntity.php(139): ActiveCollabToJiraMigrator\JiraDataObjects\ProjectEntity::buildIssueEntities(67, Object(ActiveCollabToJiraMigrator\Process\MigrationManager))
#5 /home/migrator/active-collab-to-jira-migrator/src/Process/MigrationManager.php(232): ActiveCollabToJiraMigrator\JiraDataObjects\ProjectEntity::createInstanceFromAcApiArray(Array, Object(ActiveCollabToJiraMigrator\Process\MigrationManager))
#6 /home/migrator/active-collab-to-jira-migrator/src/Process/MigrationManager.php(198): ActiveCollabToJiraMigrator\Process\MigrationManager->processProject(67)
#7 /home/migrator/active-collab-to-jira-migrator/app/index.php(128): ActiveCollabToJiraMigrator\Process\MigrationManager->processProjects(1, 33)
#8 {main}
  thrown in /home/migrator/active-collab-to-jira-migrator/src/JiraDataObjects/WorklogEntity.php on line 123

Possible workaround is to replace null with empty string or verify that comment is not null:
https://github.com/JPustkuchen/active-collab-to-jira-migrator/blob/master/src/JiraDataObjects/WorklogEntity.php#L94

replace line L94 with: $comment = $array['summary'] ?? ""; // empty string if comment is null

or add emtpy check after $comment is initiated:

if (empty($comment)) {
  // Do not create if comment is empty
  return FALSE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant