Giter Club home page Giter Club logo

Comments (12)

jeremykendall avatar jeremykendall commented on May 24, 2024 1

Please make sure you’re using the most recent version the the public suffix list. Can’t look now but update instructions should be in README.

from purl.

jwage avatar jwage commented on May 24, 2024

Thanks. Would you be willing to provide a failing test and a fix?

from purl.

jeremykendall avatar jeremykendall commented on May 24, 2024

Here you go: https://github.com/jwage/purl/blob/master/README.markdown#staying-up-to-date

from purl.

developernaren avatar developernaren commented on May 24, 2024

@jwage @jeremykendall It seems like the suffixes with key * on their array are failing

'bd' => 
  array (
    '*' => 
    array (
    ),
  )

or

 'nz' =>
  array (
    '*' =>
    array (
    ),
    'co' =>
    array (
      'blogspot' =>
      array (
      ),
    ),
  ),

There are few other like bd, pg etc.
This is fixed if you replace the content of the file

vendor/jwage/purl/data/public-suffix-list.php

with

vendor/jeremykendall/php-domain-parser/data/public-suffix-list.php

And also this code in vendor/jeremykendall/php-domain-parser/library/Pdp/Parser.php

if (array_key_exists('*', $publicSuffixList)) {
                array_unshift($publicSuffix, $part);
                $publicSuffixList = $publicSuffixList['*'];
                continue;
            }

adds all the parts in the domains to public suffix if there exist a key * for a given suffix.

So I guess the issue is as @jeremykendall pointed out, the list is not updated and also I am not sure that the fix to this would be, updating the public prefix list or not letting everything with * key into the suffix list. And since the codes are in two different repos I am a bit confused.

Please let me know if I can be of help further.

from purl.

jeremykendall avatar jeremykendall commented on May 24, 2024

Updating the file using the CLI tool did not resolve your issue?

from purl.

developernaren avatar developernaren commented on May 24, 2024

No it did not.

from purl.

jeremykendall avatar jeremykendall commented on May 24, 2024

@nyamsprod Any chance you can take a look?

from purl.

nyamsprod avatar nyamsprod commented on May 24, 2024

Seems that Purl uses v3 and not v5 of the domain parser package. I'll look if v5 has the same issue

from purl.

jeremykendall avatar jeremykendall commented on May 24, 2024

That’s due to some php extension requirements in newer versions of php-domain-parser that are not required by purl. If @jwage is OK with that I think it’s safe to upgrade.

from purl.

nyamsprod avatar nyamsprod commented on May 24, 2024

Beside the intl extension I don't believe there are any other dependencies that I'm aware of

from purl.

nyamsprod avatar nyamsprod commented on May 24, 2024

Using v5 it does work ...

use Pdp\Cache;
use Pdp\CurlHttpClient;
use Pdp\Manager;

require 'vendor/autoload.php';

$manager = new Manager(new Cache(), new CurlHttpClient());
$rules = $manager->getRules();
$domain = $rules->resolve('naren.nz');
echo '<pre>', json_encode($domain, JSON_PRETTY_PRINT);

And the result is

{
    "domain": "naren.nz",
    "registrableDomain": "naren.nz",
    "subDomain": null,
    "publicSuffix": "nz",
    "isKnown": true,
    "isICANN": true,
    "isPrivate": false
}

from purl.

jwage avatar jwage commented on May 24, 2024

We can upgrade 👍

from purl.

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.