Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPage parent() method returns null, should return NullPage #1986

Open
16th-earl opened this issue Nov 1, 2024 · 1 comment
Open

NullPage parent() method returns null, should return NullPage #1986

16th-earl opened this issue Nov 1, 2024 · 1 comment

Comments

@16th-earl
Copy link

16th-earl commented Nov 1, 2024

Short description of the issue

When applied to a NullPage object, the parent() method returns null.

Expected behavior

A NullPage object should be returned (same as the rootParent() method returns NullPage).

Actual behavior

null is returned.

Steps to reproduce the issue

$home = $pages->get('/');
var_dump($home->parent); // returns NullPage
var_dump($home->parent->parent); // returns null

Setup/Environment

  • ProcessWire version: 3.0.226
@ryancramerdesign
Copy link
Member

@16th-earl I agree that makes sense, but NullPage is its own type, and if I look at the phpdoc for the method it says it can only return null, so it appears to be intentional. I don't recall why, but am guessing it's related to parent iteration. I would prefer it to be NullPage, I'll make a note to revisit at a major version when a breaking change for this would be safer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants