From a155e0fc659197e1c7bb8a244c45f461c4261100 Mon Sep 17 00:00:00 2001
From: Damien Regad <damien.regad@merckgroup.com>
Date: Wed, 22 Feb 2012 00:48:32 +0100
Subject: [PATCH] Fix #13935: Version-based filtering not possible

Commit a68398245663d25229800638b6965ffe6e7ab0d3 for bug #13096
introduced a regression in version-based filtering due to not properly
dealing with selected version parameter when passed as an array.
---
 core/print_api.php |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/core/print_api.php b/core/print_api.php
index f8966e1..59e6d12 100644
--- a/core/print_api.php
+++ b/core/print_api.php
@@ -764,9 +764,12 @@ function print_version_option_list( $p_version = '', $p_project_id = null, $p_re
 		null );
 	}
 
-	# Ensure the current version (if specified) is included in the list
-	if( !empty( $p_version ) ) {
-		$versions[] = version_cache_row( version_get_id( $p_version, $c_project_id ) );
+	# Ensure the selected version (if specified) is included in the list
+	# Note: Filter API specifies selected versions as an array
+	if( !is_array( $p_version ) ) {
+		if( !empty( $p_version ) ) {
+			$versions[] = version_cache_row( version_get_id( $p_version, $c_project_id ) );
+		}
 	}
 
 	if( $p_leading_blank ) {
-- 
1.7.5.4

