From 0e5ad6ca9fbd928352471a4e571176c3741ef1ee Mon Sep 17 00:00:00 2001 From: David Hicks Date: Mon, 1 Mar 2010 12:22:55 +1100 Subject: [PATCH] Fix #11571: Versions 1.1 and 1.10 are treated as duplicates A problem was discovered on manage_proj_edit_page.php where if versions 1.1 and 1.10 were both shown, clicking 'edit' for 1.1 would bring up the edit version page for the 1.10 version instead. This is due to an incorrect version name comparison in version_get_id whereby the following check between strings was occurring: if( "1.1" == "1.10" ) { ... } PHP evaluates this expression to true because 1.1 and 1.10 are treated as floats. We however need to preserve the string type during this comparison, thus we need to use the === comparison operator instead. --- core/version_api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/version_api.php b/core/version_api.php index 0b0757853f..897e89baa6 100644 --- a/core/version_api.php +++ b/core/version_api.php @@ -510,7 +510,7 @@ function version_get_id( $p_version, $p_project_id = null, $p_inherit = null ) { } foreach( $g_cache_versions as $t_version ) { - if(( $t_version['version'] == $p_version ) && ( $t_version['project_id'] == $c_project_id ) ) { + if(( $t_version['version'] === $p_version ) && ( $t_version['project_id'] == $c_project_id ) ) { return $t_version['id']; } }