Skip to:
Content

bbPress.org

Opened 3 weeks ago

Closed 4 days ago

#3357 closed defect (fixed)

Search redirect fails to wp_unslash()

Reported by: dd32 Owned by: johnjamesjacoby
Milestone: 2.6.5 Priority: normal
Severity: normal Version: 2.1
Component: Component - Search Keywords: commit
Cc:

Description

As reported in https://meta.trac.wordpress.org/ticket/2024 bbPress fails to unslash the search term before redirecting to a slashed variant.

For example, search for "wordpress" will result in a redirect that ultimately uses \"wordpress\" in the displays. Oddly enough it looks like the actual search works properly, so the slash stripping might be working at a lower level.

Examples:
https://bbpress.org/forums/search/?action=bbp-search-request&bbp_search=%22wordpress%22
https://de.wordpress.org/support/search/?action=bbp-search-request&bbp_search=%22wordpress%22

I suspect bbp_get_search_terms() needs a wp_unslash() wrapped around get_query_var( bbp_get_search_rewrite_id() ) but I'm unsure how that will play out with url rewrites.

Change History (3)

#1 @johnjamesjacoby
4 days ago

  • Keywords commit added; needs-patch removed
  • Milestone changed from Awaiting Review to 2.6.5
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned
  • Version set to 2.1

I tested this morning, and adding wp_slash() where you suggested is the correct approach.

Rewrite rules continue to function normally.

Going to commit that change alongside other rewrite/search code improvements.

#2 @johnjamesjacoby
4 days ago

In 7076:

Search/Rewrites: unslash search terms inside bbp_get_search_terms().

This commit ensures that search terms appear correctly inside of template output, without additional slashes.

It also eliminates a few repeated calls to bbp_get_search_rewrite_id(), and more strictly compares rewrite rule query vars to null results for improved code clarity & consistency.

Props dd32, johnjamesjacoby.

See #3357. Trunk, for 2.7.0.

#3 @johnjamesjacoby
4 days ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 7077:

Search/Rewrites: unslash search terms inside bbp_get_search_terms().

This commit ensures that search terms appear correctly inside of template output, without additional slashes.

It also eliminates a few repeated calls to bbp_get_search_rewrite_id(), and more strictly compares rewrite rule query vars to null results for improved code clarity & consistency.

Props dd32, johnjamesjacoby.

Fixes #3357. 2.6 branch, for 2.6.5.

Note: See TracTickets for help on using tickets.