Public bug reported:

The first foreach $viewdata in the function checks if $v is an object
and casts it as one if not. Further down is a second foreach on
$viewdata (inside the "if ($gettags && !empty($viewidlist))"
conditional) but this one does no checking, which causes errors when
$viewdata items are arrays rather than objects.

Proposed fix:
change the first loop to set $v as a reference via &$v to make the cast to 
object affect the original $viewdata items. The loop only gets from $v and does 
no setting, so this will be safe to do.

Affects at least Mahara 17.04 and above.

** Affects: mahara
     Importance: Undecided
     Assignee: Mark Webster (mark-webster-v)
         Status: New

** Changed in: mahara
     Assignee: (unassigned) => Mark Webster (mark-webster-v)

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask 
on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1776448

Title:
  lib/view.php get_extra_view_info Trying to get property of non-object

Status in Mahara:
  New

Bug description:
  The first foreach $viewdata in the function checks if $v is an object
  and casts it as one if not. Further down is a second foreach on
  $viewdata (inside the "if ($gettags && !empty($viewidlist))"
  conditional) but this one does no checking, which causes errors when
  $viewdata items are arrays rather than objects.

  Proposed fix:
  change the first loop to set $v as a reference via &$v to make the cast to 
object affect the original $viewdata items. The loop only gets from $v and does 
no setting, so this will be safe to do.

  Affects at least Mahara 17.04 and above.

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

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to