Project

General

Profile

Actions

Bug #64506

closed

sysExt:Form Validation broken

Added by Stephan Ude almost 10 years ago. Updated about 6 years ago.

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

100%

Estimated time:
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 1 (0 open1 closed)

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

Actions
Actions #1

Updated by Andreas Kienast almost 10 years ago

  • Is Regression changed from No to Yes
Actions #2

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

Actions #3

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

Actions #4

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

Actions #5

Updated by Andreas Fernandez almost 10 years ago

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

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?

Actions #7

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.

Actions #8

Updated by Dmitry Dulepov over 9 years ago

  • Status changed from Accepted to Resolved
Actions #9

Updated by Björn Jacob over 9 years ago

  • Category set to 1602
Actions #10

Updated by Björn Jacob over 8 years ago

  • Category changed from 1602 to Form Framework
Actions #11

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF