Issue Bug Closed

#95042email validation makes link generation unnecessary costly

Sebastian Michaelsen 08/31/21, 06:11 updated 10/07/21, 07:15

Description

Whenever links are generated with “legacy” parameter, the \TYPO3\CMS\Core\LinkHandling\LegacyLinkNotationConverter checks if the provided parameter is a valid email address. For validation we use the 3rd party library egulias/email-validator. With blackfire I determined that this library is quite costly in terms of memory and wall time.

I added this simple early return to GeneralUtility::validEmail():

        if (strpos($email, '@') === false) {
            return false;
        }

And it significantly improved the speed of links generation. I don’t know if that is a suitable solution for the core, or if such a fix should get into the library itself.

Reviews 2