← Back to team overview

mahara-contributors team mailing list archive

[Bug 814119] Re: PHP Error when registering a new user and the default views have textbox blocks

 

I can't reproduce on master

** Changed in: mahara
       Status: Triaged => Invalid

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

Title:
  PHP Error when registering a new user and the default views have
  textbox blocks

Status in Mahara ePortfolio:
  Invalid

Bug description:
  When registering a new user, the system duplicates the views that are
  marked as copynewuser = 1 in the views table. If one of these views
  has a textbox block, it causes an error as follows:

  [Thu Jul 21 15:02:58 2011] [error] [client 128.86.248.122] [WAR] 3c (blocktype/lib.php:1134) Invalid argument supplied for foreach()
  [Thu Jul 21 15:02:58 2011] [error] [client 128.86.248.122] Call stack (most recent first):
  [Thu Jul 21 15:02:58 2011] [error] [client 128.86.248.122]   * log_message("Invalid argument supplied for foreach()", 8, true, true, "/var/www/epihrrt/docroot/blocktype/lib.php", 1134) at /var/www/epihrrt/docroot/lib/errors.php:444

  This is caused by the following code (line 1191 of blocktype/lib.php),
  which assumes that if $configdata['artefactids'] is not there, then
  $configdata['artefactids'] will be, which it isn't for this block
  type.

  // Record new artefact ids in the new block
              if (isset($configdata['artefactid'])) {
                  $configdata['artefactid'] = $artefactcopies[$configdata['artefactid']]->newid;
              }
              else {
                  foreach ($configdata['artefactids'] as &$oldid) {
                      $oldid = $artefactcopies[$oldid]->newid;
                  }
              }

  
  It needs to look like this:

  // Record new artefact ids in the new block
              if (isset($configdata['artefactid'])) {
                  $configdata['artefactid'] = $artefactcopies[$configdata['artefactid']]->newid;
              }
              else if (isset($configdata['artefactids'])) { 
                  foreach ($configdata['artefactids'] as &$oldid) {
                      $oldid = $artefactcopies[$oldid]->newid;
                  }
              }

  Mahara 1.3.6, but the code is the same in 1.4

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


References