From 3d491defbde0dff775cbfab99628f8af6f00c8aa Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 7 Dec 2004 17:42:35 +0000 Subject: - Patch #14035 by Goba: fixed problem with UTF-8 conversion when mixing LOWER() and strtolower(). --- modules/profile/profile.module | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules/profile/profile.module') diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 44d283167..df6e9fa2e 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -154,7 +154,8 @@ function profile_save_profile(&$edit, &$user, $category) { $result = db_query('SELECT fid, name, type FROM {profile_fields} WHERE register = 1 ORDER BY category, weight'); } else { - $result = db_query("SELECT fid, name, type FROM {profile_fields} WHERE LOWER(category) = '%s'", strtolower($category)); + $result = db_query("SELECT fid, name, type FROM {profile_fields} WHERE LOWER(category) = LOWER('%s')", $category); + // We use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues. } while ($field = db_fetch_object($result)) { if (_profile_field_serialize($field->type)) { @@ -250,7 +251,8 @@ function profile_form_profile($edit, $user, $category) { $result = db_query('SELECT * FROM {profile_fields} WHERE register = 1 ORDER BY category, weight'); } else { - $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = '%s' ORDER BY weight", strtolower($category)); + $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = LOWER('%s') ORDER BY weight", $category); + // We use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues. } $fields = array(); @@ -349,7 +351,8 @@ function profile_validate_profile($edit, $category) { $result = db_query('SELECT * FROM {profile_fields} WHERE register = 1 ORDER BY category, weight'); } else { - $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = '%s' ORDER BY weight", strtolower($category)); + $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = LOWER('%s') ORDER BY weight", $category); + // We use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues. } while ($field = db_fetch_object($result)) { -- cgit v1.2.3