Skip to content

Commit

Permalink
Fix #10978: Advanced filters break permalinks
Browse files Browse the repository at this point in the history
When using advanced filters with multiple items selected from a single
filter element, generation of permalinks fail due to passing an array to
rawurlencode(). Getting arrays from the parsing functions should be
expected and handled appropriately rather than blindly passing it to
rawurlencode().
  • Loading branch information
amyreese committed Sep 22, 2009
1 parent 8977d9c commit 7cfdf65
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/string_api.php
Expand Up @@ -267,7 +267,13 @@ function string_sanitize_url( $p_url, $p_return_absolute = false ) {

$t_clean_pairs = array();
foreach( $t_pairs as $t_key => $t_value ) {
$t_clean_pairs[] = rawurlencode( $t_key ) . '=' . rawurlencode( $t_value );
if ( is_array( $t_value ) ) {
foreach( $t_value as $t_value_each ) {
$t_clean_pairs[] .= rawurlencode( $t_key ) . '[]=' . rawurlencode( $t_value_each );
}
} else {
$t_clean_pairs[] = rawurlencode( $t_key ) . '=' . rawurlencode( $t_value );
}
}

if ( !empty( $t_clean_pairs ) ) {
Expand Down

0 comments on commit 7cfdf65

Please sign in to comment.