-
-
Notifications
You must be signed in to change notification settings - Fork 115
Comments
LinkGenerator: allow 'test' mode in link target validation#365
LinkGenerator: allow 'test' mode in link target validation #365Lumeriol wants to merge 1 commit intonette:v3.2 from
Conversation
The change allows the use/validation of 'test' mode over presenters containing the Requires attribute (e.g., using the isLinkCurrent method on the Error4xx presenter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where using isLinkCurrent() on presenters or actions marked with #[Requires(forward: true)] would incorrectly throw an "Invalid link" exception. The change allows the 'test' mode (used by isLinkCurrent()) to bypass the access policy validation, similar to how 'forward' mode already behaved.
- Modified link target validation to allow 'test' mode alongside 'forward' mode to skip
isLinkable()checks - Added
in_arrayto the imported functions list to support the new validation logic
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using strict comparison in in_array for consistency with the rest of the codebase. The check should be !in_array($mode, ['test', 'forward'], true) to ensure type-safe comparison. While the $mode parameter is type-hinted as string, using strict comparison is a best practice and maintains consistency with line 51 where strict equality checks are used.
f86203b to
8f6af0a
Compare
The change allows the use/validation of 'test' mode over presenters containing the Requires attribute (e.g., using the isLinkCurrent method on the Error4xx presenter).
This is reaction to this commit.