Fixed German umlauts in URL

Robert9

Well-known member
Affected version
2.1.2
For some this is a new function, for me this is a bug.

'url' => ['type' => self::STR, 'match' => 'url', 'required' => true]

This match is not able to accept a german domain with umlauts like:

http://günstig.com/
http://straße.de/

So somewhere in the regex should be öäü and ß
 
XF>Validator>url
Code:
    public function isValid($value, &$errorKey = null)
    {
        if ($this->options['allow_empty'] && $value === '')
        {
            return true;
        }

        if (!preg_match('#
            ^
            (?P<scheme>[a-zäöüß][a-z0-9+.-]*)
            :
            (?P<authority>//
                (?:
                    (?P<userinfo>[a-zäöüß0-9\-._~!$&\'()*+,;=:%]+)
                    @
                )?
                (?P<host>[a-zäöüß0-9\-.]+)
                (?:
                    :
                    (?P<port>[0-9]+)
                )?
            )?
            (?P<path>
                /[^?\#]*
            )?
            (?:
                \?
                (?P<query>[^\#]*)
            )?
            (?:
                \#
                (?P<fragment>.*)
            )?
            $
        #ix', $value, $match))
        {
            $errorKey = 'invalid';
            return false;
        }
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.5).

Change log:
Deaccent and romanize URLs before validation
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Back
Top Bottom