Issue Bug Closed

#110074"Call to a member function set() on null" on link validator run

Tobias Jungmann 06/17/26, 15:39 updated 08/11/26, 08:50

Description

When executing the linkvalidator taks via cli (or cron job), an error occurs, because there is no user session.

This seems to be a known problem in https://forge.typo3.org/issues/107974.

Trace:

[17-Jun-2026 17:14:46 Europe/Berlin] TYPO3 [ERROR] request="7c95dba07186f" component="TYPO3.CMS.Scheduler.Scheduler": Task failed to execute successfully. Task Type: TYPO3\CMS\Linkvalidator\Task\ValidatorTask, UID: 37, Code: 0, "Call to a member function set() on null" in /var/www/dsl/vendor/typo3/cms-core/Classes/Authentication/AbstractUserAuthentication.php at line 1062- Error: Call to a member function set() on null, in file /var/www/dsl/vendor/typo3/cms-core/Classes/Authentication/AbstractUserAuthentication.php:1062 - {"taskType":"TYPO3\\CMS\\Linkvalidator\\Task\\ValidatorTask","taskId":37,"exception":"Error: Call to a member function set() on null in \/var\/www\/dsl\/vendor\/typo3\/cms-core\/Classes\/Authentication\/AbstractUserAuthentication.php:1062
Stack trace:
#0 \/var\/www\/dsl\/vendor\/typo3\/cms-core\/Classes\/Messaging\/FlashMessageQueue.php(160): TYPO3\\CMS\\Core\\Authentication\\AbstractUserAuthentication->setAndSaveSessionData('core.template.f...', NULL)
#1 \/var\/www\/dsl\/vendor\/typo3\/cms-core\/Classes\/Messaging\/FlashMessageQueue.php(174): TYPO3\\CMS\\Core\\Messaging\\FlashMessageQueue->storeFlashMessagesInSession()
#2 \/var\/www\/dsl\/vendor\/typo3\/cms-core\/Classes\/Messaging\/FlashMessageQueue.php(143): TYPO3\\CMS\\Core\\Messaging\\FlashMessageQueue->removeAllFlashMessagesFromSession(NULL)
#3 \/var\/www\/dsl\/vendor\/typo3\/cms-scheduler\/Classes\/Hooks\/SchedulerTaskPersistenceValidator.php(133): TYPO3\\CMS\\Core\\Messaging\\FlashMessageQueue->getAllMessagesAndFlush()
#4 \/var\/www\/dsl\/vendor\/typo3\/cms-scheduler\/Classes\/Hooks\/SchedulerTaskPersistenceValidator.php(110): TYPO3\\CMS\\Scheduler\\Hooks\\SchedulerTaskPersistenceValidator->convertErrorMessagesToDataHandlerLog(Object(TYPO3\\CMS\\Core\\DataHandling\\DataHandler), 37)
#5 \/var\/www\/dsl\/vendor\/typo3\/cms-core\/Classes\/DataHandling\/DataHandler.php(709): TYPO3\\CMS\\Scheduler\\Hooks\\SchedulerTaskPersistenceValidator->processDatamap_preProcessFieldArray(Array, 'tx_scheduler_ta...', 37, Object(TYPO3\\CMS\\Core\\DataHandling\\DataHandler))
#6 \/var\/www\/dsl\/vendor\/typo3\/cms-scheduler\/Classes\/Domain\/Repository\/SchedulerTaskRepository.php(128): TYPO3\\CMS\\Core\\DataHandling\\DataHandler->process_datamap()
#7 \/var\/www\/dsl\/vendor\/typo3\/cms-linkvalidator\/Classes\/Task\/ValidatorTask.php(151): TYPO3\\CMS\\Scheduler\\Domain\\Repository\\SchedulerTaskRepository->update(Object(TYPO3\\CMS\\Linkvalidator\\Task\\ValidatorTask))
#8 \/var\/www\/dsl\/vendor\/typo3\/cms-scheduler\/Classes\/Scheduler.php(174): TYPO3\\CMS\\Linkvalidator\\Task\\ValidatorTask->execute()
#9 \/var\/www\/dsl\/vendor\/typo3\/cms-scheduler\/Classes\/Command\/SchedulerExecuteCommand.php(119): TYPO3\\CMS\\Scheduler\\Scheduler->executeTask(Object(TYPO3\\CMS\\Linkvalidator\\Task\\ValidatorTask))
#10 \/var\/www\/dsl\/vendor\/typo3\/cms-scheduler\/Classes\/Command\/SchedulerExecuteCommand.php(102): TYPO3\\CMS\\Scheduler\\Command\\SchedulerExecuteCommand->runTasks(Array, Array)
#11 \/var\/www\/dsl\/vendor\/typo3\/cms-scheduler\/Classes\/Command\/SchedulerExecuteCommand.php(82): TYPO3\\CMS\\Scheduler\\Command\\SchedulerExecuteCommand->askForTasksAndRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#12 \/var\/www\/dsl\/vendor\/symfony\/console\/Command\/Command.php(341): TYPO3\\CMS\\Scheduler\\Command\\SchedulerExecuteCommand->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#13 \/var\/www\/dsl\/vendor\/symfony\/console\/Application.php(1117): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#14 \/var\/www\/dsl\/vendor\/symfony\/console\/Application.php(356): Symfony\\Component\\Console\\Application->doRunCommand(Object(TYPO3\\CMS\\Scheduler\\Command\\SchedulerExecuteCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#15 \/var\/www\/dsl\/vendor\/symfony\/console\/Application.php(195): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#16 \/var\/www\/dsl\/vendor\/typo3\/cms-core\/Classes\/Console\/CommandApplication.php(113): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#17 \/var\/www\/dsl\/vendor\/typo3\/cms-cli\/typo3(23): TYPO3\\CMS\\Core\\Console\\CommandApplication->run()
#18 \/var\/www\/dsl\/vendor\/typo3\/cms-cli\/typo3(24): {closure}()
#19 \/var\/www\/dsl\/bin\/typo3(119): include('\/var\/www\/dsl\/ve...')
#20 {main}","exceptionFile":"\/var\/www\/dsl\/vendor\/typo3\/cms-core\/Classes\/Authentication\/AbstractUserAuthentication.php","exceptionLine":1062,"code":0,"message":"Call to a member function set() on null"}
Call to a member function set() on null

Reviews 2

History 1113

  1. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2026-06-18T07:33:17+00:00" > 06/18/26, 07:33 </span>

    Hi!

    It seems that DataHandler is throwing this “FlashMessage” – which should usually only occur when warnings happened during persistence.

    Can you run the task on the GUI backend and see what the flashmessage might contain here?

    And can you reproduce it on CLI usage? I can’t to produce the error, but it’s likely related to the actual linkvalidator errors/reports it finds, so I wonder how to reproduce it.

  2. Tobias Jungmann commented <span data-processor="relativetime" data-value="2026-06-18T07:52:02+00:00" > 06/18/26, 07:52 </span>

    > It seems that DataHandler is throwing this “FlashMessage” – which should usually only occur when warnings happened during persistence.
    > Can you run the task on the GUI backend and see what the flashmessage might contain here?

    When executing via GUI, the message says Task "LinkValidator [linkvalidator]" with uid "37" has been executed.
    Also, when using CLI on local machine, the error only occurs one time. After that the command is executed without errors. I have to import the production db again to reproduce the error.

    > And can you reproduce it on CLI usage? I can’t to produce the error, but it’s likely related to the actual linkvalidator errors/reports it finds, so I wonder how to reproduce it.

    I will dive deeper into it.

  3. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-06-18T09:51:44+00:00" > 06/18/26, 09:51 </span>

    Thanks, I understand this will be a bit harder to debug. Feel free to contact me if you need help.

    Ideally you would use XDebug to step through it to see what’s actually put inside the flashmessage at the position of your stacktrace, so that we could see how the chain is triggered.

    Of course we could make the validatortask create a BE User authentication too (like in the issue you mentioned), but if that even happens in the core tasks, that should be better covered.

  4. Tobias Jungmann commented <span data-processor="relativetime" data-value="2026-06-19T08:33:56+00:00" > 06/19/26, 08:33 </span>

    Found the problem.

    In https://github.com/TYPO3-CMS/linkvalidator/blob/14.3/Classes/Task/ValidatorTask.php#L454 it is checked, whether the template files exist. But there is no check for .fluid.html files. And the default template is ValidatorTask.fluid.html.

    Therefore, the check in line 427 fails and $this->taskNeedsUpdate is set to true. This triggers the update process for the task in line 151.

    In my opinion, 2 fixes are required:
    1. Check for .fluid.html files, too. Edit: In templateFileExists the template paths are EXT: paths and are not resolved. So file_exists($templatePath . $this->emailTemplateName . '.html') (EXT:linkvalidator/Resources/Private/Templates/Email/ValidatorTask.fluid.html) will always be false.
    2. Don’t update the scheduler task in cli mode. In my opinion the task should fail if the configuration is not correct.
    Or at least the error should be catched to avoid a misleading error message.

    It also seems, that the task is not updated when SchedulerTaskRepository::update is called. The $fields do not contain the email or template name, even if they were changed automatically in the ValidatorTask. So the whole update process does not work and produces errors without any reason ;)

    Also no information, that the task has been updated, is displayed in the flashmessage. But this may have some other reasons (e.g. because the db row hasn’t changed).

    Reproduce:
    The error only occurs, if there are broken links and the new result is different to the last one. Therefore, we manipulate the code (that’s easier):
    1. Got To ValidatorTask::execute and add $this->reportEmail($linkAnalyzerResult); after the second if clause.
    2. Add the Linkvalidator in the be. Set the template name to e.g. xy
    3. Run the task in cli mode via typo3 scheduler:run → The error will occur everytime.
    4. Run the task in the be via scheduler → The template name will not be updated to the default value ValidatorTask (but should do it). When debugging, you will see, that the default template name is set, but not updated in the SchedulerTaskRepository.

  5. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-06-19T09:16:04+00:00" > 06/19/26, 09:16 </span>

    Awesome that sounds like a good investigation. I will look into this next week!

    (If you feel up for contributing a gerrit patch on your own that would also be great and I could try to help you along!)

  6. Gerrit Code Review pushed patch set 1 for main to change 94539 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2026-06-22T09:46:54+00:00" > 06/22/26, 09:46 </span>

  7. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-06-22T09:50:54+00:00" > 06/22/26, 09:50 </span>

    This is really messy. I could not really salvage the “taskNeedsUpdate” logic, because it gets messier the deeper you dive. So my current patch actually removes this dynamic update logic, fixes XLIFF keys, and allows the dymamic changes to be done on each execution.

    I think this might be a valid approach, but asked for further feedback. Happy to hear yours. :)

    Thanks again for the work you did, that was really helpful.

    Regards,
    Garvin

  8. Tobias Jungmann commented <span data-processor="relativetime" data-value="2026-06-22T10:11:13+00:00" > 06/22/26, 10:11 </span>

    I think, this approach is absoluteley valid. This is the way I would have chosen.

    Thanks a lot :)

  9. Garvin Hicking commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-06-25T05:05:11+00:00" > 06/25/26, 05:05 </span>

    Applied in changeset commit:84599bfb6ccb159b85450b3bc56997768f6f3e52.