← Back to team overview

mahara-contributors team mailing list archive

[Bug 1926530] A change has been merged

 

Reviewed:  https://reviews.mahara.org/11727
Committed: https://git.mahara.org/mahara/mahara/commit/aded8a3f703818d9aab64208300d94eb179569aa
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch:    21.04_STABLE

commit aded8a3f703818d9aab64208300d94eb179569aa
Author: Doris Tam <doristam@xxxxxxxxxxxxxxx>
Date:   Thu Apr 29 15:51:04 2021 +1200

Bug 1926530: Unefined property: stdClass:: $icon

In get_profile_icons(), there's both 'faicon' and 'icon'.
But it doesn't really matter what type it is, it's still an icon.
None of the social media options have more than one icon type, so
we can simplify it to just be the 'icon'.

Change-Id: I9e063fa39f7dec5dbece8070adb34af50aa4d4f7
(cherry picked from commit a7bbba21b109c08afd12c25f41822d7bf09ea67a)

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/1926530

Title:
  Elasticsearch producing warning: Undefined property: stdClass::$icon

Status in Mahara:
  Fix Committed

Bug description:
  It is possible to produce a warning via an Elasticsearch call if the
  results produce a broken icon link.

  The warning is as follows:
  [WAR] 85 (search/elasticsearch/type/ElasticsearchType_artefact.php:332) Undefined property: stdClass::$icon
  Call stack (most recent first):
  log_message("Undefined property: stdClass::$icon", 8, true, true, "/var/www/master-dev-prod-mahara/releases/202104280...", 332) at /var/www/master-dev-prod-mahara/releases/20210428075700/lib/errors.php:515
  error(8, "Undefined property: stdClass::$icon", "/var/www/master-dev-prod-mahara/releases/202104280...", 332, array(size 7)) at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/type/ElasticsearchType_artefact.php:332
  ElasticsearchType_artefact::getRecordDataById("artefact", "3560") at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/lib.php:1926
  ElasticsearchPseudotype_all::search("TEST", 10, 0, array(size 4), null, object(LiveUser)) at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/lib.php:1073
  PluginSearchElasticsearch::search_all("TEST", 10, 0, array(size 4), null) at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/json/elasticsearch.php:53

  This was first produced on dev.mahara.org on 21.04.dev code, while
  searching for the term, "test".

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

  ## Testing on dev.mahara.org

  - $icon is an undefined property
  - function causing this error: getRecordDataById("artefact", "3560")

  Looking at the artefact table ...
  -[ RECORD 1 ]---+--------------------
  id              | 3560
  artefacttype    | socialprofile
  container       | 0
  parent          |
  owner           | 1
  institution     |
  group           |
  ctime           | 2020-10-08 13:50:27
  mtime           | 2020-10-08 13:50:27
  atime           | 2020-10-08 13:50:27
  locked          | 0
  title           | test tumblr
  description     | Tumblr
  note            | tumblr
  author          | 1
  authorname      |
  allowcomments   | 0
  approvecomments | 0
  license         |
  licensor        |
  licensorurl     |
  path            | /3560

  
  - a socialprofile artefact caused this, owned by user=1 that is catadmin
  - try adding another tumblr with username=meow
  - re-index elasticsearch
  - search for meow gives the same error

  ```bash
  [WAR] ca (search/elasticsearch/type/ElasticsearchType_artefact.php:332) Undefined property: stdClass::$icon
  Call stack (most recent first):

      log_message("Undefined property: stdClass::$icon", 8, true, true, "/var/www/master-dev-prod-mahara/releases/202104280...", 332) at /var/www/master-dev-prod-mahara/releases/20210428075700/lib/errors.php:515
      error(8, "Undefined property: stdClass::$icon", "/var/www/master-dev-prod-mahara/releases/202104280...", 332, array(size 7)) at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/type/ElasticsearchType_artefact.php:332
      ElasticsearchType_artefact::getRecordDataById("artefact", "3915") at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/lib.php:1926
      ElasticsearchPseudotype_all::search("meow", 10, 0, array(size 5), null, object(LiveUser)) at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/lib.php:1073
      PluginSearchElasticsearch::search_all("meow", 10, 0, array(size 5), null, object(LiveUser)) at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/index.php:55

  ```

  log_message("Undefined property: stdClass::$icon", 8, true, true, "/var/www/master-dev-prod-mahara/releases/202104280...", 332) at /var/www/master-dev-prod-mahara/releases/20210428075700/lib/errors.php:515
  error(8, "Undefined property: stdClass::$icon", "/var/www/master-dev-prod-mahara/releases/202104280...", 332, array(size 7)) at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/type/ElasticsearchType_artefact.php:332
  ElasticsearchType_artefact::getRecordDataById("artefact", "3560") at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/lib.php:1926
  ElasticsearchPseudotype_all::search("test", 10, 0, array(size 5), null, object(LiveUser)) at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/lib.php:1073
  PluginSearchElasticsearch::search_all("test", 10, 0, array(size 5), null, object(LiveUser)) at /var/www/master-dev-prod-mahara/releases/20210428075700/search/elasticsearch/index.php:55

  ### Trying locally

  1. Create a social profile for tumblr with meow as the username
  2. I get the same warning

  ```bash
  [DBG] 94 (search/elasticsearch/type/ElasticsearchType_artefact.php:334) Array
  (
      [0] => stdClass Object
          (
              [id] => 6
              [artefacttype] => socialprofile
              [parent] =>
              [owner] => 1
              [title] => meow
              [description] => Tumblr
              [institution] =>
              [group] =>
              [author] => 1
              [parent_artefacttype] =>
              [parent_title] =>
              [parent_description] =>
              [license] =>
              [width] =>
              [height] =>
              [note] => tumblr
              [link] =>
              [faicon] => <span class="icon icon-brand icon-lg icon-tumblr-square" style="color: #001935"></span>
          )

  )
  [WAR] 94 (search/elasticsearch/type/ElasticsearchType_artefact.php:336) Undefined property: stdClass::$icon
  ```

  - Try creating different profiles
  - Add a social media account for instagram with username=woof
  - Re-index elastic search
  - Same issue

  Turns out!

  $record->icon = $icons [0]->icon; // this property doesn't exist for all socialmedia option in public static function get_profile_icons($data) @ htdocs/artefact;internal/lib.php
  Fix => $record->icon = $icons [0]->faicon;

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


References