Default arg and actual arg key mismatch in comment sanitizer #4624
Labels
Bug
Something isn't working
Changelogged
Whether the issue/PR has been added to release notes.
P2
Low priority
Sanitizers
WS:Perf
Work stream for Metrics, Performance and Optimizer
Milestone
Bug Description
The default argument for enabling or disabling the comments live list in the comments sanitizer is set here:
https://github.com/ampproject/amp-wp/blob/1.4.4/includes/sanitizers/class-amp-comments-sanitizer.php#L23
The actual value of the argument after filtering is then supposed to be used here:
https://github.com/ampproject/amp-wp/blob/1.4.4/includes/sanitizers/class-amp-comments-sanitizer.php#L48
Note that the two use different keys, so no default value is actually set for the argument that is being used, and the condition just happens to resolve in the same way by coincidence:
Bugs like this are why I advocate using constants for pretty much any magic string we use throughout the code, as they are very hard to detect otherwise.
Expected Behaviour
The default argument should be set to the same key as the actual value being used.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: