← Back to team overview

mahara-contributors team mailing list archive

[Bug 1924949] A patch has been submitted for review

 

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

-- 
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 Released

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