Opened 2 years ago
Closed 2 years ago
#2773 closed Defect (worksforme)
User-specified Metastrings conflicting with predefined metastrings
| Reported by: | ppragides | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Needs Review |
| Component: | Core | Version: | 1.7 |
| Severity: | minor | Keywords: | |
| Cc: | brett@… | Difficulty: |
Description
Hello,
We found a bug in the elgg system that results in some conflicts in some predefined metastrings. In the particular case we found, one of the users entered "Phone" as a venue in the event calendar. This in turn created a new entry in the metastrings database called "Phone".
Since the user profile has already defined "phone" as one of its metastrings, we now have two "phone" entries in the metastrings table (phone and Phone). However, since the code used to retrieve metadata is not case-sensitive, it retrieves the latest entry (Phone) which comes up blank for users on their profile.
Thanks,
Paolo
Change History (8)
comment:1 Changed 2 years ago by cash
comment:2 Changed 2 years ago by ppragides
Hello,
Thanks for the response. We are using the default profile plugin that comes with Elgg. The version of Elgg that we're using is 1.7.4.
We've since renamed the value of the "Phone" entry to "Telecon" as a hotfix, but here's what their ID's are:
"phone" - 88
"Telecon" (previously "Phone") - 8029
Here's the first result in
+-------+-------------+---------+----------+------------+------------+-----------+--------------+---------+
| id | entity_guid | name_id | value_id | value_type | owner_guid | access_id | time_created | enabled |
+-------+-------------+---------+----------+------------+------------+-----------+--------------+---------+
| 35826 | 7 | 88 | 58 | text | 7 | 1 | 1289446122 | yes |
I hope this helps.
Thanks,
Paolo
comment:3 Changed 2 years ago by cash
Thanks for the detailed report. It looks like this is a retrieval issue. When I have tested this, I have not been able to reproduce it.
I'll try to work up some test code to further diagnosis the problem.
comment:4 Changed 2 years ago by ppragides
Hello,
Just wondering if you guys have found any resolution to this?
Let me know if you need any further information.
Thanks,
Paolo
comment:5 Changed 2 years ago by ppragides
Hello,
Just wanted to send in an update on this.
This seems to be fixed by changing the default case_sensitive parameter on the get_metadata_byname function to true instead of false. It looks like if there are two metastrings with the same name, the get_metastring_id function returns an array of metastring IDs, instead of a single ID.
Is there a reason the case_sensitive is set to default to false?
Thanks,
Paolo
comment:6 Changed 2 years ago by cash
Thanks for staying with us on this.
Your comment confuses me. This is what happens in get_metadata_byname:
function get_metadata_byname($entity_guid, $meta_name) {
global $CONFIG;
$meta_name = get_metastring_id($meta_name);
And get_metastring_id has this definition:
function get_metastring_id($string, $case_sensitive = TRUE) {
So by default get_metadata_byname() does a case sensitive retrieval of the name id.
comment:7 Changed 2 years ago by cash
Any progress on checking your code to see if it is using case sensitive by default like it should?
comment:8 Changed 2 years ago by cash
- Resolution set to worksforme
- Status changed from new to closed

Thank you for the report.
I just tried to reproduce this and could not. The access of the metastrings table defaults to case sensitive so this should work.
Are you using any 3rd party profile plugins or the default one that comes with Elgg?
What version of Elgg?
If possible, could you look into the metastrings table and post the two ids of 'phone' and 'Phone' along with the metadata ids of the name and value of a user's profile phone field in the metadata table?