purl icon indicating copy to clipboard operation
purl copied to clipboard

subdomain and registerableDomain no longer work

Open rkyoku opened this issue 5 years ago • 2 comments

Hi,

subdomain and registerableDomain no longer seem to work with version 1.0.0 but they did work fine before updating the lib, with version 0.7.0.

rkyoku avatar Feb 03 '20 23:02 rkyoku

See https://github.com/jwage/purl/pull/76#issue-269674114, as of 1.0.0 you need to use https://github.com/jeremykendall/php-domain-parser directly yourself.

Also see https://github.com/jwage/purl/issues/79

@jwage can you release a new patch version to prevent this kind of misunderstandings?

holtkamp avatar Mar 09 '20 13:03 holtkamp

The biggest issue here IMHO is that access to $url->registerableDomain still works without any warnings (but always return null). Unless you do proper tests in your app, this would introduce bugs that are very difficult to track.

Fixing this is seems simple, though. Just change Purl/AbstractPart->get() to check if the key exists in $this->data and issue a PHP notice if not (this will mimic PHP's behaviour when accessing undefined properties).

flaviovs avatar Jun 26 '20 01:06 flaviovs