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

Closed
grischpel opened this issue Feb 9, 2024 · 1 comment

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
@sbusemann sbusemann added this to the _under investigation milestone Oct 23, 2024
@pixeldesu pixeldesu removed this from the _under investigation milestone Nov 5, 2024
@pixeldesu
Copy link
Member

I checked this and I don't our validators support use cases outside of tx_femanager_ plugins, especially with the switch to v8 and multiple plugins, we now specifically check for things running in one of the allowed plugins through PluginService, so upgrading wouldn't fix this issue either.

Please reimplement the password checking logic in your case here.

@pixeldesu pixeldesu closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 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

3 participants