After the migration from latest Flow 3.x to Flow 4.0.6 several Packages are not working anymore.
After core:migrate all packages, an error appears as following:
privilege target "TYPO3.AccountManagement:Profile", referenced in role
configuration "TYPO3.AccountManagement:Administrator" is not defined!
I tracked down the problem to the ConfigurationManager->mergePolicyConfiguration, where the privilegeTargets are overridden by each package (not merged as expected!) - even with empty arrays - in the Arrays::arrayMergeRecursiveOverrule method.
The problem is the main Package Neos.Flow. In the Policy.yaml of the Package an empty array is defined for privilegeTargets, which overrides all configuration of packages loaded before:
I think either the empty array initiation should be removed or the Neos.Flow Configuration loaded as first package, as its done for other configurations:
Looking at the code of the ConfigurationManager, there has something changed since Flow 3.x:
I’ve experience the same, but it was due to wrong dependency. So my own package didn’t require neos/flow which caused the array to be reset.
If you have changed namespace from typo3/* to neos/* check that you have done it everywhere, so that you don’t have any reference to typo3/flow - that will cause the same issue.