Moodle

Parameters for calling constructor of UserSearchDocument and UserPostSearchDocument in function user_single_document() is not right.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.9.5
  • Fix Version/s: None
  • Component/s: Global search
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

Prototype declarations are there:

class UserSearchDocument extends SearchDocument {
(1) public function __construct(&$userhash, $user_id, $context_id) {
class UserPostSearchDocument extends SearchDocument {
(2) public function __construct(&$post, $user_id, $context_id) {

In function user_single_document(), these constructors are called as follows:
(1) return new UserSearchDocument($userhash, $user->id, 'user', null);
(2) return new UserPostSearchDocument($posthash, $post->userid, 'post', null);

To match call with prototype, we need to change as follows:
(1) return new UserSearchDocument($userhash, $user->id, null);
(2) return new UserPostSearchDocument($posthash, $post->userid, null);

------------------
Original code about (2) was,
(2) return new UserPostSearchDocument($posthash, $user->id, 'post', null);
but we also need to change $user->id to $post->id, since we does not know userid directly from $user->id when itemtype equals 'post'.

Activity

Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
Michael de Raadt added a comment -

I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Show
Michael de Raadt added a comment - I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: