I installed 2.2, and tried to edit a Text field, and entered the 'Validation'page.
I get the following error:
Parse error: syntax error, unexpected T_STATIC, expecting ')' in ..\field_validation\field_validation_extras\plugins\validator\field_validation_date_validator.inc on line 24
The relevant code is:
const PATTERN = '/^(\d{4})-(\d{2})-(\d{2})$/';
public function validate() {
//The logic copied from Symfony\Component\Validator\Constraints\DateValidator
if (!preg_match(static::PATTERN, $this->value, $matches) || !checkdate($matches[2], $matches[3], $matches[1])) {
...
Comments
Comment #1
johnv1. Why is this date-validator invoked on a text field?
2. I don't understand the error in line 24, but line 23 can be simplified:
Comment #2
g089h515r806 commentedThe code was copied from:
Symfony\Component\Validator\Constraints\DateValidator
Comment #3
DrupalDan commentedsame error. Sub...
Comment #4
GroggySylv commentedAlso have the problem. Any solution?
Comment #5
g089h515r806 commentedI have tested it again, it works correctly.
I use PHP 5.3, Apache/2.2.21, WIndows7, MYSQL 5.5.16.
Comment #5.0
g089h515r806 commentedmore precise info.
Comment #6
johnvI enabled it with 5.2.17 and got the error (with 2.2).
I enabled it with 5.3.9 and got no error (with 2.2).
Is it a PHP-version thing? I use Acquia Dev Desktop on Windows 7.
EDIT
Also, i saw that the file 'field_validation_date_validator.inc' is not included in the latest 2.x version.Is it replaced with 'field_validation_date_range2_validator.inc' ?
Comment #7
cr0ss commentedThe PATTERN is being declared as constant but for some reason is used as static variable in line 24. Attaching patch which is fixing this.
Comment #8
2phaPatch above fixed it for me :)
Comment #9
g089h515r806 commentedcommited
Comment #10
g089h515r806 commentedComment #11.0
(not verified) commentedadded code for better reference.