Duplicate tags in page creation gives error message

Bug #1231920 reported by Marion MacDonald
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Low
Robert Lyon
1.8
Fix Released
Low
Robert Lyon

Bug Description

Has anyone noticed, when creating a page, that if you put a tag in twice, the page will be created but you get an error message? I've tested this on two accounts and it's consistent - I've been able to test it on our own site and on a free host.

The error message is: Site unavailable

A nonrecoverable error occured. This probably means you have encountered a bug in the system

For example, if you create a page, and put the tags university and University, the error is given.

Our version of Mahara is 1.7.0 but I'm not sure what the free host has (it has all the same functions as our own).

Firefox 23 and IE 9

Marion

Tags: tags mysql
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hello Marion,

I tested on http://demo.mahara.org and could not replicate the problem. The site is on Mahara 1.7.2.

Steps I took:

1. Create a new page.
2. Enter a page title.
3. Enter in the tag field: University, university
4. Click the "Save" button.
5. No error message.

Can you please also check on the demo site with the steps you took? Please let us know if they differ from mine.

Since the error message on the screen is not very telling, can you please check your server error log for any more information and paste that here (obscuring / deleting all revealing info about your server first).

Cheers
Kristina

Revision history for this message
Aaron Wells (u-aaronw) wrote :

I was able to replicate this in MySQL.

It looks like it's because in MySQL the primary key on the view_tags table is case-insensitive, while in Postgresql it's case-sensitive.

tags: added: mysql tags
Changed in mahara:
status: New → Confirmed
importance: Undecided → Medium
importance: Medium → Low
Revision history for this message
Robert Lyon (robertl-9) wrote :

have added a patch for this:
https://reviews.mahara.org/#/c/2553/

Changed in mahara:
status: Confirmed → In Progress
assignee: nobody → Robert Lyon (robertl-9)
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: none → 1.8.1
Revision history for this message
Robert Lyon (robertl-9) wrote :

Here is some information about mysql collation types and how they handle case sensitivity
http://stackoverflow.com/questions/10929836/utf8-bin-vs-utf-unicode-ci

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Confirmed
assignee: Robert Lyon (robertl-9) → nobody
Revision history for this message
Aaron Wells (u-aaronw) wrote :

Some updates on this. Robert's supplied patch changes the collation type of some columns to binary. We'd need to do this in on installation as well (which wouldn't be too hard, just toss it in the post-install function).

We were discussing at a meeting recently whether it might be a good idea to just set the default collation for the whole database, to binary. Apparently there is at least one of our clients who has done this with a production Mahara instance, and it has worked out fine for them as far as we know.

If we did decide to do that, we could make it be part of the installation sanity check. That way, people setting up new databases would be prompted to set the collation correctly, while people in existing Mahara databases would not find their site suddenly complaining about it.

Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.8.1 → 1.9.0
Revision history for this message
Robert Lyon (robertl-9) wrote :

I've altered the patch - have taken another approach.

Now the patch checks the table collation for mysql and if is case insensitive then reduces the tag array to unique lowercase options.

A useful sql query for testing mysql tables (going from case insensitive to case sensitive)

  alter table <tablename> convert to character set utf8 collate utf8_bin;

Revision history for this message
Steven (stevens-q) wrote :

=== Bug #1231920 Duplicate tags in page creation gives error message ===
Test Plan
------------
1. Create a new page.
2. Enter a page title.
3. Enter in the tag field: University, university
4. Click the "Save" button.
5. Confirm that there are no error messages using OS Linux & windows7 IE9

Test Result
-------------
5. Confirmed that there are no error messages. ✔

**Note:** I am unable to test this bug because I do not have a MySQL database - works on Postgres

Catalyst QA Approved ✔

Aaron Wells (u-aaronw)
tags: added: test2
tags: removed: test2
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/2553
Committed: http://gitorious.org/mahara/mahara/commit/ae9591c2f086cd55b85089e0b62ff6f9527e23a5
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit ae9591c2f086cd55b85089e0b62ff6f9527e23a5
Author: Robert Lyon <email address hidden>
Date: Fri Jan 3 13:30:45 2014 +1300

Checking case sensitivity for mysql tag tables (bug #1231920)

Compressing array of tags to unique case insensitive values if needed

Eg
array('Test','cat','test','TEST','Cat');

will become
array('Test','cat');

for mysql sites that have case insensitive tables

Change-Id: Idf0b8a4440ef0f9273d5be685cf7ad22fecc746a
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Aaron, are we going to change it also for 1.8 or only 1.9 seeing that it's marked as "low"?

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "1.8_STABLE" branch: https://reviews.mahara.org/3147

Revision history for this message
Robert Lyon (robertl-9) wrote :

Seen as the patch merges without problems we might as well change it for 1.8 as well

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/3147
Committed: http://gitorious.org/mahara/mahara/commit/681da955542322305fcf6ea69e205ed57736b7a3
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.8_STABLE

commit 681da955542322305fcf6ea69e205ed57736b7a3
Author: Robert Lyon <email address hidden>
Date: Fri Jan 3 13:30:45 2014 +1300

Checking case sensitivity for mysql tag tables (bug #1231920)

Compressing array of tags to unique case insensitive values if needed

Eg
array('Test','cat','test','TEST','Cat');

will become
array('Test','cat');

for mysql sites that have case insensitive tables

Change-Id: Idf0b8a4440ef0f9273d5be685cf7ad22fecc746a
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
no longer affects: mahara/1.9
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.