Create a project A from Scrum template (site admin should approve it if needed).
Now create a project B from the project A ("From another project I'm admin of).
The creation fails ☹️. Here is what is written in the /var/log/tuleap/rest_api_log
file:
2021-01-07T22:43:41+01:00 [23338] [error] Unhandled exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1231' for key 'PRIMARY':
#0 /usr/share/tuleap/src/vendor/paragonie/easydb/src/EasyDB.php(1005): PDOStatement->execute(Array)
#1 /usr/share/tuleap/src/vendor/paragonie/easydb/src/EasyDB.php(948): ParagonIE\EasyDB\EasyDB->safeQuery('INSERT INTO tra...', Array, 2, false, true)
#2 /usr/share/tuleap/plugins/tracker/include/Tracker/Hierarchy/HierarchyDAO.php(266): ParagonIE\EasyDB\EasyDB->run('INSERT INTO tra...', 1230, 1231)
#3 /usr/share/tuleap/plugins/tracker/include/Tracker/Hierarchy/HierarchyFactory.class.php(290): Tuleap\Tracker\Hierarchy\HierarchyDAO->duplicate(1176, 1177, Array)
#4 /usr/share/tuleap/plugins/tracker/include/Tracker/TrackerFactory.class.php(546): Tracker_HierarchyFactory->duplicate(Array)
#5 /usr/share/tuleap/plugins/tracker/include/Tracker/TrackerManager.class.php(814): TrackerFactory->duplicate('240', 249, Array)
#6 /usr/share/tuleap/plugins/tracker/include/trackerPlugin.php(587): TrackerManager->duplicate('240', 249, Array)
#7 /usr/share/tuleap/src/common/Event/EventManager.class.php(127): trackerPlugin->register_project_creation(Array)
#8 /usr/share/tuleap/src/common/plugin/PluginLoader.php(72): EventManager->eventManagerDispatch('register_projec...', Object(trackerPlugin), 'register_projec...', false, Array)
#9 /usr/share/tuleap/src/common/Event/EventManager.class.php(116): Tuleap\Plugin\PluginLoader->Tuleap\Plugin\{closure}('register_projec...', Array)
#10 /usr/share/tuleap/src/common/Event/EventManager.class.php(104): EventManager->processEventOnListener('register_projec...', Array, Array)
#11 /usr/share/tuleap/src/common/Project/ProjectCreator.class.php(462): EventManager->processEvent('register_projec...', Array)
#12 /usr/share/tuleap/src/common/Project/ProjectCreator.class.php(856): ProjectCreator->createProject(Object(ProjectCreationData))
#13 /usr/share/tuleap/src/common/Project/ProjectCreator.class.php(341): ProjectCreator->processProjectCreation(Object(ProjectCreationData))
#14 /usr/share/tuleap/src/common/Project/REST/v1/RestProjectCreator.php(204): ProjectCreator->createFromRest('testproject14', 'TestProject14', Object(Tuleap\Project\Registration\Template\TemplateFromProjectForCreation), Array)
#15 /usr/share/tuleap/src/common/Project/REST/v1/RestProjectCreator.php(170): Tuleap\Project\REST\v1\RestProjectCreator->createProjectFromTemplateId(Object(Tuleap\Project\REST\v1\ProjectPostRepresentation), Object(PFUser))
#16 /usr/share/tuleap/src/common/Project/REST/v1/RestProjectCreator.php(140): Tuleap\Project\REST\v1\RestProjectCreator->createProjectWithSelectedTemplate(Object(PFUser), Object(Tuleap\Project\REST\v1\ProjectPostRepresentation))
#17 /usr/share/tuleap/src/common/Project/REST/v1/ProjectResource.class.php(193): Tuleap\Project\REST\v1\RestProjectCreator->create(Object(PFUser), Object(Tuleap\Project\REST\v1\ProjectPostRepresentation))
#18 [internal function]: Tuleap\Project\REST\v1\ProjectResource->post(Object(Tuleap\Project\REST\v1\ProjectPostRepresentation))
#19 /usr/share/tuleap/src/vendor/luracast/restler/vendor/Luracast/Restler/Restler.php(1058): ReflectionMethod->invokeArgs(Object(Tuleap\Project\REST\v1\ProjectResource), Array)
#20 /usr/share/tuleap/src/vendor/luracast/restler/vendor/Luracast/Restler/Restler.php(304): Luracast\Restler\Restler->call()
#21 /usr/share/tuleap/src/www/api/index.php(91): Luracast\Restler\Restler->handle()
#22 {main}
According to git bisect
, this comes from git #tuleap/stable/7354dc36f94f312bf99f819f2a58b693d2e56a61, see request #18487.
It is strange that it has not been spotted during the last valid, maybe we should add a (automated) test for this scenario?