Can't create forum post - adodb issue

Bug #1406372 reported by Kristina Hoeppner
This bug report is a duplicate of:  Bug #1402911: Error posting a new forum topic. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
Critical
Unassigned

Bug Description

Son says it's related to the adodb upgrade:

Test case on the latest master:
1. Create a group.
2. Write a forum post and submit it.
3. Get big error message.

----------------------------------------------------

[WAR] 82 (lib/errors.php:747) Failed to get a recordset: postgres8 error: [-2: ERROR: syntax error at or near "group"
LINE 1: SELECT group FROM "interaction_instance" WHERE "id" = $1
              ^] in EXECUTE("SELECT group FROM "interaction_instance" WHERE "id" = ? ")
Command was: SELECT group FROM "interaction_instance" WHERE "id" = ? and values was (1)
Call stack (most recent first):

    log_message("Failed to get a recordset: postgres8 error: [-2: E...", 8, true, true) at /home/kristina/code/mahara/htdocs/lib/errors.php:97
    log_warn("Failed to get a recordset: postgres8 error: [-2: E...") at /home/kristina/code/mahara/htdocs/lib/errors.php:747
    SQLException->__construct("Failed to get a recordset: postgres8 error: [-2: E...") at /home/kristina/code/mahara/htdocs/lib/dml.php:477
    get_recordset_sql("SELECT group FROM "interaction_instance" WHERE "i...", array(size 1)) at /home/kristina/code/mahara/htdocs/lib/dml.php:788
    get_field_sql("SELECT group FROM "interaction_instance" WHERE "i...", array(size 1)) at /home/kristina/code/mahara/htdocs/lib/dml.php:776
    get_field("interaction_instance", "group", "id", 1) at /home/kristina/code/mahara/htdocs/interaction/forum/edittopic.php:198
    addtopic_submit(object(Pieform), array(size 9)) at Unknown:0
    call_user_func_array("addtopic_submit", array(size 2)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:527
    Pieform->__construct(array(size 4)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:162
    Pieform::process(array(size 4)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 4)) at /home/kristina/code/mahara/htdocs/interaction/forum/edittopic.php:173

[WAR] 82 (lib/dml.php:477) Failed to get a recordset: postgres8 error: [-2: ERROR: syntax error at or near "group"
LINE 1: SELECT group FROM "interaction_instance" WHERE "id" = $1
              ^] in EXECUTE("SELECT group FROM "interaction_instance" WHERE "id" = ? ")
Command was: SELECT group FROM "interaction_instance" WHERE "id" = ? and values was (1)
Call stack (most recent first):

    get_recordset_sql("SELECT group FROM "interaction_instance" WHERE "i...", array(size 1)) at /home/kristina/code/mahara/htdocs/lib/dml.php:788
    get_field_sql("SELECT group FROM "interaction_instance" WHERE "i...", array(size 1)) at /home/kristina/code/mahara/htdocs/lib/dml.php:776
    get_field("interaction_instance", "group", "id", 1) at /home/kristina/code/mahara/htdocs/interaction/forum/edittopic.php:198
    addtopic_submit(object(Pieform), array(size 9)) at Unknown:0
    call_user_func_array("addtopic_submit", array(size 2)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:527
    Pieform->__construct(array(size 4)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:162
    Pieform::process(array(size 4)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:71
    pieform(array(size 4)) at /home/kristina/code/mahara/htdocs/interaction/forum/edittopic.php:173

[WAR] 82 (lib/form/elements/wysiwyg.php:87) Invalid argument supplied for foreach()
Call stack (most recent first):

    log_message("Invalid argument supplied for foreach()", 8, true, true, "/home/kristina/code/mahara/htdocs/lib/form/element...", 87) at /home/kristina/code/mahara/htdocs/lib/errors.php:441
    error(2, "Invalid argument supplied for foreach()", "/home/kristina/code/mahara/htdocs/lib/form/element...", 87, array(size 2)) at /home/kristina/code/mahara/htdocs/lib/form/elements/wysiwyg.php:87
    pieform_element_wysiwyg_get_headdata(array(size 8)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:1732
    pieform_get_headdata() at /home/kristina/code/mahara/htdocs/lib/web.php:92
    smarty(array(size 0), array(size 0), array(size 0), array(size 1)) at /home/kristina/code/mahara/htdocs/lib/errors.php:576
    MaharaException->handle_exception() at /home/kristina/code/mahara/htdocs/lib/errors.php:467
    exception(object(SQLException)) at Unknown:0

[WAR] 82 (lib/form/elements/wysiwyg.php:94) Invalid argument supplied for foreach()
Call stack (most recent first):

    log_message("Invalid argument supplied for foreach()", 8, true, true, "/home/kristina/code/mahara/htdocs/lib/form/element...", 94) at /home/kristina/code/mahara/htdocs/lib/errors.php:441
    error(2, "Invalid argument supplied for foreach()", "/home/kristina/code/mahara/htdocs/lib/form/element...", 94, array(size 2)) at /home/kristina/code/mahara/htdocs/lib/form/elements/wysiwyg.php:94
    pieform_element_wysiwyg_get_headdata(array(size 8)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:1732
    pieform_get_headdata() at /home/kristina/code/mahara/htdocs/lib/web.php:92
    smarty(array(size 0), array(size 0), array(size 0), array(size 1)) at /home/kristina/code/mahara/htdocs/lib/errors.php:576
    MaharaException->handle_exception() at /home/kristina/code/mahara/htdocs/lib/errors.php:467
    exception(object(SQLException)) at Unknown:0

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

Patch for "master" branch: https://reviews.mahara.org/4116

Revision history for this message
Son Nguyen (ngson2000) wrote :

It's fixed by the patch https://reviews.mahara.org/#/c/4097
However, the patch https://reviews.mahara.org/4116 is worth to prevent the future error of using Postgres/MySQL reserved keywords

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

Reviewed: https://reviews.mahara.org/4116
Committed: http://gitorious.org/mahara/mahara/commit/f97166d19f77877b1e198e9d53a19a6a7a61816a
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit f97166d19f77877b1e198e9d53a19a6a7a61816a
Author: Son Nguyen <email address hidden>
Date: Tue Dec 30 10:17:12 2014 +1300

Make sure the field name is quoted in get_field() and get_column()

Bug 1406372

After upgrade ADOdb, the SQL query which uses keywords as field name
causes the syntax error.

Change-Id: I072e9fd35d9415246f755186e7481a9686ce431f
Signed-off-by: Son Nguyen <email address hidden>

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

Patch for "master" branch: https://reviews.mahara.org/4219

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

Reviewed: https://reviews.mahara.org/4219
Committed: http://gitorious.org/mahara/mahara/commit/9b682972accad1b080936ea331367bd2960175a9
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 9b682972accad1b080936ea331367bd2960175a9
Author: Robert Lyon <email address hidden>
Date: Wed Jan 28 11:21:51 2015 +1300

Make sure the 'COUNT(*)' is not quoted for get_field() (Bug #1406372)

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

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

Patch for "master" branch: https://reviews.mahara.org/4230

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

Reviewed: https://reviews.mahara.org/4230
Committed: http://gitorious.org/mahara/mahara/commit/252a644ffa4275514890aedf37003608284e60d1
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 252a644ffa4275514890aedf37003608284e60d1
Author: Yuliya Bozhko <email address hidden>
Date: Thu Jan 29 16:09:27 2015 +1300

Make sure the SQL functions are not quoted (Bug #1406372)

Change-Id: I8ac41fc9915e5ceb7be4b452164d5749b14470a0
Signed-off-by: Yuliya Bozhko <email address hidden>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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