Bug #64506
closedsysExt:Form Validation broken
100%
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.
Updated by Andreas Kienast almost 10 years ago
- Is Regression changed from No to Yes
Updated by Gerrit Code Review almost 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36275
Updated by Gerrit Code Review almost 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36275
Updated by Gerrit Code Review almost 10 years ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36315
Updated by Andreas Fernandez almost 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6a5400bcda232e4092be0efc568e7f12842b1df2.
Updated by Peter Müller over 9 years ago
I've this Bug on 6.2.10 where self::
is already changed to static::
PHP 5.4.17 running.
How can I Fix this?
Updated by Dmitry Dulepov over 9 years ago
- Status changed from Resolved to Accepted
The issue is not resolved. Reverting the status to Accepted.
Same error with PHP 5.3.4 on Debian:
Fatal error: Undefined class constant 'LOCALISATION_OBJECT_NAME' in /var/lib/typo3/TYPO3_6-2/typo3/sysext/form/Classes/Validation/AbstractValidator.php on line 250
The problem is that AbstractValidator requires a certain constant and many 3rd party validators do not implement it (and cannot be forced to implement a constant). So it is a programming error to rely on the non-existing constant in the class and assume that every derieved class will implement it.
You can reproduce the issue with the mailform and wtspamshield extension versions < 1.3.1.
Updated by Dmitry Dulepov over 9 years ago
- Status changed from Accepted to Resolved
Updated by Björn Jacob over 8 years ago
- Category changed from 1602 to Form Framework