jwage / purl

Purl is a simple Object Oriented URL manipulation library for PHP 7.2+
MIT License
907 stars 123 forks source link

subdomain and registerableDomain no longer work #80

Open rkyoku opened 4 years ago

rkyoku commented 4 years ago

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.

holtkamp commented 4 years ago

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?

flaviovs commented 4 years ago

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).