-
Notifications
You must be signed in to change notification settings - Fork 228
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
Closes #6661: safeguard exclusions for non valid path #7254
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
For testing:
|
Manual wrong values in database will cause error (related discussion https://wp-media.slack.com/archives/D01HV2TGKQD/p1738767822946699) => correct link https://wp-media.slack.com/archives/C43T1AYMQ/p1716485105461249
if atf set to null in db
if lcp manually edited in db to {} |
@Mai-Saad These errors are non regression as they are happening on |
@Mai-Saad I've added some checks to make sure |
Description
Fixes #6661
Avoid potential fatal error if the string url is not valid.
Type of change
Detailed scenario
Refer to the issue.
Technical description
Documentation
This pull request includes updates to the
get_path_for_exclusion
function in theController.php
file and adds a new test case in theaddExclusions.php
file. The changes aim to improve the handling of URL paths and ensure proper filtering of exclusions.Enhancements to URL path handling:
inc/Engine/Media/AboveTheFold/Frontend/Controller.php
: Modified theget_path_for_exclusion
function to check if the path is set and is a string before returning it. If not set, it returns null. Additionally, it filters out null values from the exclusions array before returning it.Testing improvements:
tests/Fixtures/inc/Engine/Media/AboveTheFold/Frontend/Controller/addExclusions.php
: Added a new test casetestShouldReturnEmptyStringWhenUrlNotValid
to verify that invalid URLs result in empty strings and the exclusions array is properly filtered.New dependencies
None
Risks
None
Mandatory Checklist
Code validation
Code style