femanager icon indicating copy to clipboard operation
femanager copied to clipboard

Classes/Domain/Validator/PasswordValidator.php throws an warning when in debug mode but not in live mode

Open grischpel opened this issue 1 year ago • 0 comments

Classes/Domain/Validator/PasswordValidator.php throws an error when in debug mode but not in live mode

PHP Warning: Trying to access array offset on value of type null in /public/typo3conf/ext/femanager/Classes/Domain/Validator/PasswordValidator.php line 138

image

 /**
     * Initialize Validator Function
     */
    protected function init()
    {
        $this->configuration = $this->configurationManager->getConfiguration(
            ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS,
            'Femanager',
            'Pi1'
        );
        $this->cObj = $this->configurationManager->getContentObject();
        $this->piVars = GeneralUtility::_GP('tx_femanager_pi1');
        $this->actionName = $this->piVars['__referrer']['@action'];
    }

I called this from my own validator:

public function validatePassword(User $user, string $password): bool {
	  $user->setPassword($password);

	  /** @var PasswordValidator */
	  $validator = GeneralUtility::makeInstance(\In2code\Femanager\Domain\Validator\PasswordValidator::class);
	  $validator->configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);

	  return $validator->isValid($user);
	}

I think the problem is, that my extension gives another name then this: $this->piVars = GeneralUtility::_GP('tx_femanager_pi1'); in the header:

tx_name_profile[__referrer][@controller]: User
tx_name_profile[__referrer][@action]: showProfile
tx_name_profile[__referrer][@extension]: Name

grischpel avatar Feb 09 '24 14:02 grischpel