Giter Site home page Giter Site logo

Not work unicode domain name about php-whois HOT 2 OPEN

regru avatar regru commented on June 20, 2024
Not work unicode domain name

from php-whois.

Comments (2)

UnsupportedCallbackException avatar UnsupportedCallbackException commented on June 20, 2024

россия.онлайн не проходит регэксп

from php-whois.

UnsupportedCallbackException avatar UnsupportedCallbackException commented on June 20, 2024

https://github.com/regru/php-whois/blob/master/src/Phois/Whois/Whois.php#L24

Если добавить \d во второй части регэкспа то "россия.онлайн" валидируется

preg_match('/^(xn\-\-[\p{L}\d\-]+)\.(xn\-\-(?:[\p{L}\-]+\.?1?)+)$/ui', $this->domain, $matches) 
preg_match('/^(xn\-\-[\p{L}\d\-]+)\.(xn\-\-(?:[\p{L}\d\-]+\.?1?)+)$/ui', $this->domain, $matches) 

Хотя \p{L} в купе с флагами /ui довольно странный выбор, т.к. он матчит любые буквы из люблого языка, в то время как Punycode допускает только буквы латинского алфавита, цифры и дефис. Данный регэксп вполне может пропустить xn--ыыы.xn--ыыы. В целом [\p{L}\d-] можно заменить на [a-z\d-] в обоих местах.

from php-whois.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.