Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
grischpel opened this issue Feb 9, 2024 · 0 comments

Comments

@grischpel
Copy link

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 grischpel changed the title Classes/Domain/Validator/PasswordValidator.php throws an error when in debug mode but not in live mode Classes/Domain/Validator/PasswordValidator.php throws an warning when in debug mode but not in live mode Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant