To replicate:

0. Have your search plugin set to "Internal" (not Elasticsearch)

1. Go to "Administration -> Extensions -> Plugin administration ->
artefact:internal"

2. In the "Searchable fields" section, tick "Email address". Save.

3. Type some search text into the "Search users" box that appears at the
top of every Mahara page.

Expected result: You should see search results that indicate whether or
not your search string matched any users

Actual result: It doesn't work. Depending on the page you're on, you may
simply see a status message that says "A nonrecoverable error occurred",
or you may get a big ugly error stack.

[WAR] e6 (lib/errors.php:747) Failed to get a recordset: mysqli error: [-9999: 
Input Array does not match ?:
            SELECT
                COUNT(u.id)
            FROM "usr" u
                LEFT OUTER JOIN "usr_account_preference" h ON (u.id = 
h.usr AND h.field = 'hiderealname')
            WHERE
                u.id != 0 AND u.active = 1 AND u.deleted = 0
                AND (
                    LOWER(u.preferredname) = 'snth'
                    OR (
                        (u.preferredname IS NULL OR u.preferredname = '' OR NOT 
FALSE OR h.value != '1' OR h.value IS NULL)
                        AND (LOWER(u.firstname) = 'snth' OR LOWER(u.lastname) = 
'snth')
                    )
                    OR (TRUE AND LOWER(u.username) = 'snth')
                    OR LOWER(u.studentid) = 'snth'
                    OR (LOWER(u.email) = 'snth' OR (SELECT email FROM 
"artefact_internal_profile_email" ai WHERE ai.email = 1 AND ai.owner 
= u.id AND ai.verified = 1) = ] in Execute(, )
Command was:
            SELECT
                COUNT(u.id)
            FROM "usr" u
                LEFT OUTER JOIN "usr_account_preference" h ON (u.id = h.usr AND 
h.field = 'hiderealname')
            WHERE
                u.id != 0 AND u.active = 1 AND u.deleted = 0
                AND (
                    LOWER(u.preferredname) = ?
                    OR (
                        (u.preferredname IS NULL OR u.preferredname = '' OR NOT 
FALSE OR h.value != '1' OR h.value IS NULL)
                        AND (LOWER(u.firstname) = ? OR LOWER(u.lastname) = ?)
                    )
                    OR (TRUE AND LOWER(u.username) = ?)
                    OR LOWER(u.studentid) = ?
                    OR (LOWER(u.email) = ? OR (SELECT email FROM 
"artefact_internal_profile_email" ai WHERE ai.email = ? AND ai.owner = u.id AND 
ai.verified = 1) = ?)
                )
                AND u.id != ? and values was (snth,snth,snth,snth,snth,snth,1)
Call stack (most recent first):

    log_message("Failed to get a recordset: mysqli error: [-9999: I...", 8, 
true, true) at /home/aaronw/www/mahara/htdocs/lib/errors.php:97
    log_warn("Failed to get a recordset: mysqli error: [-9999: I...") at 
/home/aaronw/www/mahara/htdocs/lib/errors.php:747
    SQLException->__construct("Failed to get a recordset: mysqli error: [-9999: 
I...") at /home/aaronw/www/mahara/htdocs/lib/dml.php:480
    get_recordset_sql(" SELECT COUNT(u.id) ...", array(size 7)) at 
/home/aaronw/www/mahara/htdocs/lib/dml.php:269
    count_records_sql(" SELECT COUNT(u.id) ...", array(size 7)) at 
/home/aaronw/www/mahara/htdocs/search/internal/lib.php:159
    PluginSearchInternal::search_user("snth", 10, 0, array(size 1)) at Unknown:0
    call_user_func_array(array(size 2), array(size 4)) at 
/home/aaronw/www/mahara/htdocs/lib/mahara.php:1693
    call_static_method("PluginSearchInternal", "search_user", "snth", 10, 0, 
array(size 1)) at /home/aaronw/www/mahara/htdocs/lib/searchlib.php:52
    search_user("snth", 10, 0, array(size 1)) at 
/home/aaronw/www/mahara/htdocs/user/find.php:43

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask 
on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1514272

Title:
  Doing user search with 'email' option on breaks search

Status in Mahara:
  In Progress
Status in Mahara 15.10 series:
  Confirmed
Status in Mahara 16.04 series:
  In Progress

Bug description:
  The fix for https://bugs.launchpad.net/mahara/+bug/1507777

  broke the user search when a site has 'Email address' ticked for searchable 
fields under 
  Administration -> Extensions -> Plugin type: artefact -> Internal -> 
configuration form.

  The problem being that there are now 2 extra values for the prepare
  string that are not being added to the $values array

  I'll fix up

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1514272/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : mahara-contributors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to