Skip to content

IBX-11694: Corrected condition for DisableSiteRootCheckboxIfRootLocationListener #1896

Open
mateuszdebinski wants to merge 2 commits into5.0from
IBX-11694-cant-set-url-alias-in-the-root
Open

IBX-11694: Corrected condition for DisableSiteRootCheckboxIfRootLocationListener #1896
mateuszdebinski wants to merge 2 commits into5.0from
IBX-11694-cant-set-url-alias-in-the-root

Conversation

@mateuszdebinski
Copy link
Copy Markdown
Contributor

@mateuszdebinski mateuszdebinski commented Apr 28, 2026

🎫 Issue IBX-11694

Description:

In v5.0, we've shortened this if statement to check the opposite of 4.6, so instead of:

if (null !== $location && 1 >= $location->depth)

It should be:
if (null === $location || 1 < $location->depth)

But it's
if (null === $location || 1 >= $location->depth)

The first part has been correctly changed, while the second part remains the same, which now causes incorrect operation.

Old behaviour is correct, but incorrect we changed it when we moved code to v5.0

@mateuszdebinski mateuszdebinski requested a review from a team April 28, 2026 14:23
@mateuszdebinski mateuszdebinski self-assigned this Apr 28, 2026
@mateuszdebinski mateuszdebinski added Bug Something isn't working Ready for review labels Apr 28, 2026
@konradoboza
Copy link
Copy Markdown
Contributor

@mateuszdebinski the PR's title says absolutely nothing about the fix itself, please adjust it to be more informative. 😉

@mateuszdebinski mateuszdebinski changed the title IBX-11694: The condition has been corrected to be consistent with the previous one IBX-11694: Correct condition for DisableSiteRootCheckboxIfRootLocationListener Apr 28, 2026
@mateuszdebinski mateuszdebinski changed the title IBX-11694: Correct condition for DisableSiteRootCheckboxIfRootLocationListener IBX-11694: Corrected condition for DisableSiteRootCheckboxIfRootLocationListener Apr 28, 2026
@ViniTou
Copy link
Copy Markdown
Contributor

ViniTou commented May 8, 2026

But after changes

After what changes?

@Steveb-p
Copy link
Copy Markdown
Contributor

Steveb-p commented May 8, 2026

But after changes

After what changes?

I assume it's upmerge from 4.6 to 5.0 that got changes wrong. @mateuszdebinski ?

@ViniTou
Copy link
Copy Markdown
Contributor

ViniTou commented May 8, 2026

@Steveb-p
but its still the old one on 4.6 branch.
https://github.com/ibexa/admin-ui/blob/4.6/src/lib/Form/EventListener/DisableSiteRootCheckboxIfRootLocationListener.php#L22

this is 8 years old code, there was no changes to that statement that I can find, and even more this was resolving actual issue at that time. How the fix correspond to old behaviour?

@mateuszdebinski
Copy link
Copy Markdown
Contributor Author

mateuszdebinski commented May 8, 2026

@Steveb-p but its still the old one on 4.6 branch. https://github.com/ibexa/admin-ui/blob/4.6/src/lib/Form/EventListener/DisableSiteRootCheckboxIfRootLocationListener.php#L22

this is 8 years old code, there was no changes to that statement that I can find, and even more this was resolving actual issue 8 years ago. How the fix correspond to old behaviour?

In v5.0, we've shortened this if statement to check the opposite of 4.6, so instead of:

if (null !== $location && 1 >= $location->depth)

It should be:
if (null === $location || 1 < $location->depth)

but it's
if (null === $location || 1 >= $location->depth)

But the first part has been correctly changed, while the second part remains the same, which now causes incorrect operation.

Old behaviour is correct, but incorrect we changed it when we moved code to v5.0

Copy link
Copy Markdown
Contributor

@ViniTou ViniTou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mateuszdebinski
ah, now i get it, miss that change from !== to === in history, focused on second part only. Well, not sure why this change was made, anyway 👍, but for the future, that is thr description that should go into the PR.

Copy link
Copy Markdown
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's a functionality that could use a simple unit test IMHO

Comment thread src/lib/Form/EventListener/DisableSiteRootCheckboxIfRootLocationListener.php Outdated
Copy link
Copy Markdown
Contributor

@konradoboza konradoboza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 but I agree with @alongosz. @mateuszdebinski please provide some unit test coverage.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

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

Labels

Bug Something isn't working Ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants