Skip to:
Content

bbPress.org

Opened 4 years ago

Closed 4 years ago

#3357 closed defect (bug) (fixed)

Search redirect fails to wp_unslash()

Reported by: dd32's profile dd32 Owned by: johnjamesjacoby's profile 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 years 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 years 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 years 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.