Issue Bug Closed

#64506sysExt:Form Validation broken

Stephan Ude 01/26/15, 14:19 updated 10/02/18, 11:46

Description

This bug does not occur in the latest release 6.2.9. It’s only present in the latest version from the 6.2 branch.

When using the email validation on a field, I get this error when I try to show the form in FE:

Fatal error: Undefined class constant 'LOCALISATION_OBJECT_NAME' in [...]/typo3/sysext/form/Classes/Validation/AbstractValidator.php

I’ve had a quick look into this. The actual class of the object was EmailValidator. The constant LOCALISATION_OBJECT_NAME is defined inside this class.

The lines causing the trouble are:

protected function getLocalLanguageLabel($type) {
    $label = self::LOCALISATION_OBJECT_NAME . '.' . $type;
    $message = $this->localizationHandler->getLocalLanguageLabel($label);
    return $message;
}

Changing self to static seems to fix the error. The PHP documentation (actually the comments) says that self is referring to the class context in which the constant is used (AbstractValidator) while static is taking the actual class context into account (EmailValidator).

My guess is that this is a PHP version issue. Unfortunately I can’t test this with PHP 5.3 or 5.4 right now. With PHP 5.5 and 5.6 I get this error.

Reviews 2