In get_site_by_path(), avoid passing $paths through prepare(). If a path contains a %, we end up with problems. see #27003.
git-svn-id: https://develop.svn.wordpress.org/trunk@27439 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
15533d1d1f
commit
ff3c96208a
@ -350,8 +350,9 @@ function get_site_by_path( $domain, $path, $segments = null ) {
|
||||
|
||||
if ( count( $paths ) > 1 ) {
|
||||
$paths = "'" . implode( "', '", $wpdb->_escape( $paths ) ) . "'";
|
||||
$site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs
|
||||
WHERE domain = %s AND path IN ($paths) ORDER BY CHAR_LENGTH(path) DESC LIMIT 1", $domain ) );
|
||||
$sql = $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $domain );
|
||||
$sql .= " AND path IN ($paths) ORDER BY CHAR_LENGTH(path) DESC LIMIT 1";
|
||||
$site = $wpdb->get_row( $sql );
|
||||
} else {
|
||||
$site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s and path = %s", $domain, $paths[0] ) );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user