typo3typo3-12.x

I am getting a "count() on null" error in the ActionController class


I have recently updated an extension to v12. From the beginning, I have had an error of

Call to a member function count() on null
in vendor/typo3/cms-extbase/Classes/Mvc/Controller/ActionController.php line 321

and

Call to a member function addNewArgument() on null
in vendor/typo3/cms-extbase/Classes/Mvc/Controller/ActionController.php line 302

Without my current temporary fix, I am having the issue that "$this->arguments" has not been defined at 2 points: "initializeActionMethodValidators()" for count() and "initializeActionMethodArguments()" for addNewArgument().
My current temporary fix is this (used at the very top in both affected functions):

if(is_null($this->arguments)){
$this->arguments = GeneralUtility::makeInstance(Arguments::class);
}

And yes, I know I should not make changes in core files. But I have yet to find another way to fix this.
Is there a solution / potential reason for this?


Solution

  • Thanks to @GarvinHicking (and Thank you to @Chris aswell, even if what you said did not lead me to the right answer this time)

    Are you aware of overwriting methods that are marked "internal" and are not supposed to be used in consuming code? [...] Otherwise, the arguments array should be set via the "injectConfigurationManager" method. Is that maybe not called in your case?!

    "injectConfigurationManager()" was not being called since, in my case, an Overwrite existed in the AbstractBaseController of the Extension.

    I commented out / deleted that Overwrite, likely a leftover from a earlier TYPO3 version, and the error went away.