← Back to team overview

mahara-contributors team mailing list archive

[Bug 1924949] A change has been merged

 

Reviewed:  https://reviews.mahara.org/11708
Committed: https://git.mahara.org/mahara/mahara/commit/2d26c1404290ea821e8ca6e539a5b279ca77f14d
Submitter: Lisa Seeto (lisaseeto@xxxxxxxxxxxxxxx)
Branch:    21.04_STABLE

commit 2d26c1404290ea821e8ca6e539a5b279ca77f14d
Author: Robert Lyon <robertl@xxxxxxxxxxxxxxx>
Date:   Wed Apr 28 09:41:00 2021 +1200

Bug 1924949: Making sure $tabdata array is not empty

Before trying to get an array value in the file selector when setting
up tabular items

Change-Id: I5c5478238a8c3ac10aea15a13d36b13d4658ecdb
Signed-off-by: Robert Lyon <robertl@xxxxxxxxxxxxxxx>
(cherry picked from commit c7fc1b89ec897ce0bacbb19e95cac060655c274c)

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1924949

Title:
  Error when adding an image block to a site page

Status in Mahara:
  Fix Committed

Bug description:
  When you create a site page and add an image block, the warning below
  appears when you navigate away from the page.

  Robert says:

  "Why does htdocs/lib/form/elements/filebrowser.php expect there to be
  tabs made and then ignores this for site pages?"

  ---
  if (!empty($element['tabs'])) {
      $tabdata = pieform_element_filebrowser_configure_tabs($element, $prefix);
   ...
  ---

  Then

  ---
  if ($viewowner['type'] == 'institution' && $viewowner['id'] == 'mahara') {
      // No filebrowser tabs for site views
      return null;
  }
  ---

  "I believe the problem relates to those two bits of code".

  How to replicate:

  1. Create a site page
  2. Add the 'Image' block, upload an image, and save the block configuration.
  3. Go to the 'Edit access' page (for example).

  Expected result: The page loads correctly.
  Actual result: The error message below.



  [WAR] 6d (lib/form/elements/filebrowser.php:49) Trying to access array offset on value of type null
  Call stack (most recent first):

      log_message("Trying to access array offset on value of type nul...", 8, true, true, "/home/kristina/code/mahara/htdocs/lib/form/element...", 49) at /home/kristina/code/mahara/htdocs/lib/errors.php:515
      error(8, "Trying to access array offset on value of type nul...", "/home/kristina/code/mahara/htdocs/lib/form/element...", 49, array(size 11)) at /home/kristina/code/mahara/htdocs/lib/form/elements/filebrowser.php:49
      pieform_element_filebrowser(object(Pieform), array(size 17)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:1605
      Pieform->build_element_html(array(size 17)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:760
      Pieform->build() at /home/kristina/code/mahara/htdocs/blocktype/lib.php:1656
      BlockInstance->build_configure_form(true) at /home/kristina/code/mahara/htdocs/blocktype/lib.php:1232
      BlockInstance->render_editing(true, true) at /home/kristina/code/mahara/htdocs/lib/view.php:2553
      View->changeblockinstance(array(size 5)) at /home/kristina/code/mahara/htdocs/lib/view.php:1930
      View->process_changes() at /home/kristina/code/mahara/htdocs/view/blocks.json.php:30

  [WAR] 4e (lib/form/elements/filebrowser.php:49) Trying to access array offset on value of type null
  Call stack (most recent first):

      log_message("Trying to access array offset on value of type nul...", 8, true, true, "/home/kristina/code/mahara/htdocs/lib/form/element...", 49) at /home/kristina/code/mahara/htdocs/lib/errors.php:515
      error(8, "Trying to access array offset on value of type nul...", "/home/kristina/code/mahara/htdocs/lib/form/element...", 49, array(size 11)) at /home/kristina/code/mahara/htdocs/lib/form/elements/filebrowser.php:49
      pieform_element_filebrowser(object(Pieform), array(size 17)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:1605
      Pieform->build_element_html(array(size 17)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:760
      Pieform->build() at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:1045
      Pieform->json_reply(0array(size 8), null) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:1012
      Pieform->reply(0array(size 7)) at /home/kristina/code/mahara/htdocs/blocktype/lib.php:1187
      BlockInstance->instance_config_store(object(Pieform), array(size 5)) at /home/kristina/code/mahara/htdocs/lib/pieforms/pieform.php:572
      Pieform->__construct(array(size 15)) at /home/kristina/code/mahara/htdocs/lib/mahara.php:5497
      pieform_instance(array(size 15)) at /home/kristina/code/mahara/htdocs/blocktype/lib.php:1649
      BlockInstance->build_configure_form() at /home/kristina/code/mahara/htdocs/view/blocks.php:72

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