•  
      request #27929 Crash when trying to get the display name of some specific users
    Infos
    #27929
    Thomas Gerbet (tgerbet)
    2022-08-10 14:27
    2022-08-09 13:16
    29488
    Details
    Crash when trying to get the display name of some specific users

    Some "special" users does not respect the annotations sets by the getUsername and getRealName methods and return null.

    Example:

    UserManager::instance()->getUserAnonymous()->getUserName(); // null instead of a string
    

    Trace:

    PHP Fatal error:  Uncaught TypeError: UserHelper::getDisplayName(): Argument #1 ($user_name) must be of type string, null given, called in /usr/share/tuleap/src/common/User/UserHelper.class.php on line 214 and defined in /usr/share/tuleap/src/common/User/UserHelper.class.php:93
    Stack trace:
    #0 /usr/share/tuleap/src/common/User/UserHelper.class.php(214): UserHelper->getDisplayName()
    #1 /usr/share/tuleap/src/common/User/UserHelper.class.php(231): UserHelper->getDisplayNameFromUser()
    #2 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List_Bind_UsersValue.php(54): UserHelper->getDisplayNameFromUserId()
    #3 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List_Bind_Users.php(82): Tracker_FormElement_Field_List_Bind_UsersValue->getLabel()
    #4 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List_Bind_Users.php(98): Tracker_FormElement_Field_List_Bind_Users->format()
    #5 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List_Bind.php(246): Tracker_FormElement_Field_List_Bind_Users->formatMailCriteriaValue()
    #6 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List.php(727): Tracker_FormElement_Field_List_Bind->formatMailArtifactvalue()
    #7 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field.php(518): Tracker_FormElement_Field_List->fetchMailArtifactValue()
    #8 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container.php(320): Tracker_FormElement_Field->fetchMailArtifact()
    #9 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container.php(305): Tracker_FormElement_Container->getContainerContent()
    #10 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container_Column.php(71): Tracker_FormElement_Container->fetchMailRecursiveArtifact()
    #11 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container_Column_Group.php(96): Tracker_FormElement_Container_Column->fetchMailArtifactInGroup()
    #12 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container_Column_Group.php(68): Tracker_FormElement_Container_Column_Group->fetchMailGroup()
    #13 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container_Column.php(176): Tracker_FormElement_Container_Column_Group->fetchMailArtifact()
    #14 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container_Column.php(66): Tracker_FormElement_Container_Column->fetchWithColumnGroup()
    #15 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container.php(320): Tracker_FormElement_Container_Column->fetchMailArtifact()
    #16 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container.php(305): Tracker_FormElement_Container->getContainerContent()
    #17 /usr/share/tuleap/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Container.php(59): Tracker_FormElement_Container->fetchMailRecursiveArtifact()
    #18 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Artifact.php(422): Tracker_FormElement_Container->fetchMailArtifact()
    #19 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Artifact.php(399): Tuleap\Tracker\Artifact\Artifact->fetchMailFormElements()
    #20 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/EmailNotificationTask.php(386): Tuleap\Tracker\Artifact\Artifact->fetchMail()
    #21 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/EmailNotificationTask.php(337): Tuleap\Tracker\Artifact\Changeset\PostCreation\EmailNotificationTask->getBodyText()
    #22 /usr/share/tuleap/src/common/Date/TimezoneSwitcher.php(40): Tuleap\Tracker\Artifact\Changeset\PostCreation\EmailNotificationTask->Tuleap\Tracker\Artifact\Changeset\PostCreation\{closure}()
    #23 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/EmailNotificationTask.php(345): Tuleap\Date\TimezoneSwitcher->setTimezoneForSpecificUserExecutionContext()
    #24 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/EmailNotificationTask.php(158): Tuleap\Tracker\Artifact\Changeset\PostCreation\EmailNotificationTask->getMessageContent()
    #25 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/EmailNotificationTask.php(116): Tuleap\Tracker\Artifact\Changeset\PostCreation\EmailNotificationTask->buildAMessagePerRecipient()
    #26 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/ActionsRunner.php(190): Tuleap\Tracker\Artifact\Changeset\PostCreation\EmailNotificationTask->execute()
    #27 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/ActionsRunner.php(166): Tuleap\Tracker\Artifact\Changeset\PostCreation\ActionsRunner->processPostCreationActions()
    #28 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/AsynchronousActionsRunner.php(86): Tuleap\Tracker\Artifact\Changeset\PostCreation\ActionsRunner->processAsyncPostCreationActions()
    #29 /usr/share/tuleap/plugins/tracker/include/Tracker/Artifact/Changeset/PostCreation/AsynchronousActionsRunner.php(53): Tuleap\Tracker\Artifact\Changeset\PostCreation\AsynchronousActionsRunner->process()
    #30 /usr/share/tuleap/plugins/tracker/include/trackerPlugin.php(1737): Tuleap\Tracker\Artifact\Changeset\PostCreation\AsynchronousActionsRunner::addListener()
    #31 /usr/share/tuleap/src/common/Event/EventManager.class.php(127): trackerPlugin->workerEvent()
    #32 /usr/share/tuleap/src/common/Plugin/PluginLoader.php(73): EventManager->eventManagerDispatch()
    #33 /usr/share/tuleap/src/common/Event/EventManager.class.php(116): Tuleap\Plugin\PluginLoader->Tuleap\Plugin\{closure}()
    #34 /usr/share/tuleap/src/common/Event/EventManager.class.php(146): EventManager->processEventOnListener()
    #35 /usr/share/tuleap/src/common/Queue/TaskWorker/TaskWorkerProcessCommand.php(72): EventManager->dispatch()
    #36 /usr/share/tuleap/src/vendor/symfony/console/Command/Command.php(291): Tuleap\Queue\TaskWorker\TaskWorkerProcessCommand->execute()
    #37 /usr/share/tuleap/src/vendor/symfony/console/Application.php(998): Symfony\Component\Console\Command\Command->run()
    #38 /usr/share/tuleap/src/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
    #39 /usr/share/tuleap/src/common/CLI/Application.php(75): Symfony\Component\Console\Application->doRun()
    #40 /usr/share/tuleap/src/vendor/symfony/console/Application.php(171): Tuleap\CLI\Application->doRun()
    #41 /usr/share/tuleap/src/utils/tuleap.php(287): Symfony\Component\Console\Application->run()
    #42 {main}
      thrown in /usr/share/tuleap/src/common/User/UserHelper.class.php on line 93
    
    Other
    Empty
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Thomas Gerbet (tgerbet)
    Closed
    2022-08-10
    Attachments
    Empty
    References

    Follow-ups