diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-12-07 17:42:35 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-12-07 17:42:35 +0000 |
commit | 3d491defbde0dff775cbfab99628f8af6f00c8aa (patch) | |
tree | b37bbd9f63793d95de152bf9cc927020b19111b9 | |
parent | 33baf53cdd08a12b437b86e4df26d388dc4824cc (diff) | |
download | brdo-3d491defbde0dff775cbfab99628f8af6f00c8aa.tar.gz brdo-3d491defbde0dff775cbfab99628f8af6f00c8aa.tar.bz2 |
- Patch #14035 by Goba: fixed problem with UTF-8 conversion when mixing LOWER() and strtolower().
-rw-r--r-- | modules/profile.module | 9 | ||||
-rw-r--r-- | modules/profile/profile.module | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/modules/profile.module b/modules/profile.module index 44d283167..df6e9fa2e 100644 --- a/modules/profile.module +++ b/modules/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)) { 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)) { |