egulias/EmailValidator

Compile Error! Declaration of Egulias\EmailValidator\Validation\MessageIDValidation::getError()...

robert-pod-trak opened this issue · 7 comments

Hi and congrats on this software,

Around October 2021 emails stopped sending at all. Fuel PHP just gives it's "Ooops! Something went wrong". On my dev site though I get the below even after removing and doing a composer re-install. :

Compile Error!
ErrorException [ Compile Error ]:
Declaration of Egulias\EmailValidator\Validation\MessageIDValidation::getError() must be compatible with Egulias\EmailValidator\Validation\EmailValidation::getError(): Egulias\EmailValidator\Result\InvalidEmail

DOCROOT/fuel/vendor/egulias/email-validator/src/Validation/MessageIDValidation.php @ line 10

class MessageIDValidation implements EmailValidation
{
....

Backtrace
COREPATH/bootstrap.php @ line 80

Many thanks,
Robert

Hi @robert-pod-trak
Latest version show them both equal:
https://github.com/egulias/EmailValidator/blob/3.x/src/Validation/EmailValidation.php#L26
https://github.com/egulias/EmailValidator/blob/3.x/src/Validation/MessageIDValidation.php#L47

The only difference is the docblock, missing in MessageIDValidation but that shouldn't give a compilation error.
Are you on the latest version?

v3.1.1

elso get this :

Backtrace
COREPATH/bootstrap.php @ line 80

75        else
76        {
77            logger(\Fuel::L_ERROR, 'shutdown - ' . $e->getMessage()." in ".$e->getFile()." on ".$e->getLine());
78        }
79    }
80    return \Errorhandler::shutdown_handler();
81});
82
83set_exception_handler(function ($e)
84{
85    // reset the autoloader

my cpmoser installed.json :

"name": "egulias/email-validator",
            "version": "3.1.1",
            "version_normalized": "3.1.1.0",
            "source": {
                "type": "git",
                "url": "https://github.com/egulias/EmailValidator.git",
                "reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c81f18a3efb941d8c4d2e025f6183b5c6d697307",
                "reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307",
                "shasum": ""
            },
            "require": {
                "doctrine/lexer": "^1.2",
                "php": ">=7.2",
                "symfony/polyfill-intl-idn": "^1.15"
            },
            "require-dev": {
                "php-coveralls/php-coveralls": "^2.2",
                "phpunit/phpunit": "^8.5.8|^9.3.3",
                "vimeo/psalm": "^4"
            },
            "suggest": {
                "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
            },
            "time": "2021-04-01T18:37:14+00:00",
            "type": "library",
            "extra": {
                "branch-alias": {
                    "dev-master": "3.0.x-dev"
                }
            },
            "installation-source": "dist",
            "autoload": {
                "psr-4": {
                    "Egulias\\EmailValidator\\": "src"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Eduardo Gulias Davis"
                }
            ],
            "description": "A library for validating emails against several RFCs",
            "homepage": "https://github.com/egulias/EmailValidator",
            "keywords": [
                "email",
                "emailvalidation",
                "emailvalidator",
                "validation",
                "validator"
            ],
            "support": {
                "issues": "https://github.com/egulias/EmailValidator/issues",
                "source": "https://github.com/egulias/EmailValidator/tree/3.1.1"
            },
            "funding": [
                {
                    "url": "https://github.com/egulias",
                    "type": "github"
                }
            ],
            "install-path": "../egulias/email-validator"
        },

Thanks

Hi again. Have upgraded to 3.1.2 but to no avail. May be a clash with SwiftMailer we also use in tandem? Or, Possibly we need PHP over version 7.0? Thanks, Robert

Hi there.
Thanks for the patience. You do need PHP >=7.2 https://github.com/egulias/EmailValidator/blob/3.x/composer.json#L16

Cool. Let me know so I can close the issue.

I don't know if this helps identify the cause of your error, but I got the same error when installing an older version of an application on top of a newer version (without deleting the old files first).

The result was that I had the MessageIDValidation class from v3 present in an installation that used v2.

SymfonyMailer uses class_exists(MessageIDValidation::class), which triggers the error.