Skip to content

Add backslash coverage to wp_options LIKE escaping tests#468

Merged
cbravobernal merged 1 commit into
trunkfrom
fix/like-escaping-backslash-coverage
Jun 12, 2026
Merged

Add backslash coverage to wp_options LIKE escaping tests#468
cbravobernal merged 1 commit into
trunkfrom
fix/like-escaping-backslash-coverage

Conversation

@cbravobernal

Copy link
Copy Markdown
Contributor

Summary

Test-only follow-up to #462 / #467 (review feedback).

The wp_options LIKE-escaping regression tests asserted that % and _ are escaped, and the comments note esc_like() also covers the \ escape character — but no test case exercised \. This adds a backslash-prefix case to both:

  • tests/php/includes/functions/test-acf-option-meta-like-escaping.php
  • tests/php/includes/test-like-escaping-parity.php

Each new case was confirmed to fail against the previous str_replace( '_', '\_', … ) escaping (which left \ active) and pass with esc_like(), so the tests now fully match their stated claim.

No production code changes.

  • composer test:php (the two classes): OK (7 tests). phpcs: clean.

Use of AI Tools

Authored by Claude Code (Claude Fable 5) under human direction.

The escaping tests asserted % and _ are escaped, and the comments note
esc_like() also covers the \ escape character, but no case exercised it.
Add a backslash-prefix case to both the option-meta and parity tests;
each was confirmed to fail against the previous str_replace('_','\_')
escaping (which left \ active) and pass with esc_like().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props cbravobernal.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@cbravobernal cbravobernal merged commit b92c0a1 into trunk Jun 12, 2026
19 of 20 checks passed
@cbravobernal cbravobernal deleted the fix/like-escaping-backslash-coverage branch June 12, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant