Bug #64506

sysExt:Form Validation broken

Added by Stephan Ude about 5 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2015-01-26
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

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.


Related issues

Precedes TYPO3 Core - Bug #65548: sysExt:Form Validation broken in 6.2.10 Closed 2015-03-05

Associated revisions

Revision 6a5400bc (diff)
Added by Andreas Fernandez about 5 years ago

[BUGFIX] Call LOCALISATION_OBJECT_NAME 'static'ally

Use static:: instead of self:: to call the constant
LOCALISATION_OBJECT_NAME.

Resolves: #64506
Releases: master, 6.2
Change-Id: I855dd65c2ca9ca47003d5dc0816f96a89512bc62
Reviewed-on: http://review.typo3.org/36275
Reviewed-by: Mathias Schreiber <>
Tested-by: Mathias Schreiber <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision c2f4aca6 (diff)
Added by Andreas Fernandez about 5 years ago

[BUGFIX] Call LOCALISATION_OBJECT_NAME 'static'ally

Use static:: instead of self:: to call the constant
LOCALISATION_OBJECT_NAME.

Resolves: #64506
Releases: master, 6.2
Change-Id: I855dd65c2ca9ca47003d5dc0816f96a89512bc62
Reviewed-on: http://review.typo3.org/36315
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Andreas Fernandez about 5 years ago

  • Is Regression changed from No to Yes

#2 Updated by Gerrit Code Review about 5 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

#3 Updated by Gerrit Code Review about 5 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

#4 Updated by Gerrit Code Review about 5 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

#5 Updated by Andreas Fernandez about 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#6 Updated by Peter Müller almost 5 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?

#7 Updated by Dmitry Dulepov almost 5 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.

#8 Updated by Dmitry Dulepov almost 5 years ago

  • Status changed from Accepted to Resolved

#9 Updated by Bjoern Jacob over 4 years ago

  • Category set to 1602

#10 Updated by Bjoern Jacob almost 4 years ago

  • Category changed from 1602 to Form Framework

#11 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF