Skip to content

Fix copyright notice detection for relative file paths - #509

Open
martatorredev wants to merge 1 commit into
WordPress:trunkfrom
martatorredev:fix/481-copyright-notice
Open

martatorredev wants to merge 1 commit into
WordPress:trunkfrom
martatorredev:fix/481-copyright-notice

Conversation

@martatorredev

Copy link
Copy Markdown

Description

Fixes false positives in Copyright_Notice_Check when theme file paths are relative.

Previously, three stripos() calls used implicit boolean evaluation. When a filename matched at position 0, PHP treated the result as false, causing valid copyright notices to be ignored.

This change uses strict false !== stripos() comparisons, consistent with the existing license.txt check.

Testing

Manually tested seven cases:

  • Relative style.css, readme.txt, readme.md and license.txt.
  • Absolute style.css path.
  • Missing copyright notice.
  • Unrelated theme path.

All seven cases passed.

PHP syntax validation and git diff --check passed.

PHP_CodeSniffer reports four pre-existing violations in this file; the patch introduces no new violations.

Additional context

This issue was identified while investigating #481. However, the original reported false positive could not be reproduced with Oenology 3.5.2, so this PR only claims to address the confirmed relative-path bug.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant