We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

messageSize ErrorMessage not working in File Validation

// My Code
$this->add(
            'image',
            new File(
                [
                    'maxSize' => '2M',
                    'messageSize' => ':field überschreitet die maximale Dateigröße :max',
                    'allowedTypes' => [
                        'image/jpeg',
                        'image/png',
                    ],
                    'messageType' => 'Erlaubte Datentypen: :types',
                ]
            )
        );

// Example from Phalcon Docs
$validator->add(
    "file",
    new FileValidator(
        [
            "maxSize"              => "2M",
            "messageSize"          => ":field exceeds the max filesize (:max)",
            "allowedTypes"         => [
                "image/jpeg",
                "image/png",
            ],
            "messageType"          => "Allowed file types are :types",
            "maxResolution"        => "800x600",
            "messageMaxResolution" => "Max resolution of :field is :max",
        ]
    )
);

I can override the messageType but when I try to override the messageSize it always shows the default.

well I have seen the source code and all looks right. It's pretty extrange



643

well I have seen the source code and all looks right. It's pretty extrange

It is indeed strange because in my validation tests it prints the custom message if the type is wrong but not when the file size is to large

what OS and PHP version are using?



643

PHP is running on Ubuntu 16.04.3 on Version 7.0.22

Phalcon is on 3.2.4

and im working on Windows

Do you see any difference between windows and linux? for example in windows with php 7.1 the boolean properties in models doesn't work well

Probably it's a bug, create a new issue in github maybe someone have a solution

Good luck