Commit 9b3e36e2 authored by Robert Lyon's avatar Robert Lyon

Bug 1812910: Importer needs to use is_array() before count() in PHP 7.2

When we are wanting to check if there is an array to foreach loop over
and that array has at least one entry.

Currently we try to loop over entries by checking with just count() and we get error
- count(): Parameter must be an array or an object that implements Countable

behatnotneeded

Change-Id: I9accca2e97f415d5f9a2203b6fd984a41e95a4d0
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 6c209a96
{if count($entryannotations)}
{if is_array($entryannotations) && count($entryannotations)}
<div class="section-import">
<h2>{str tag=Annotation section=artefact.annotation}</h2>
{foreach from=$entryannotations item=annotation}
......
{if count($entryfiles)}
{if is_array($entryfiles) && count($entryfiles)}
<div class="section-import">
<h2>{str tag=file section=artefact.file}</h2>
{foreach from=$entryfiles item=file}
......
......@@ -2,7 +2,7 @@
<h2>{str tag=profile section=artefact.internal}</h2>
<div class="form-group collapsible-group">
{foreach from=$profilegroups item=profilegroup name='profilegroup'}
{if count($profilegroup.fields)}
{if is_array($profilegroup.fields) && count($profilegroup.fields)}
<fieldset id="{$profilegroup.id}_fs" class="pieform-fieldset collapsible {if $dwoo.foreach.profilegroups.last} last{/if}">
<legend>
<h4>
......@@ -14,7 +14,7 @@
</legend>
<div id="profilefield-{$profilegroup.id}" class="collapse list-group">
{foreach from=$profilegroup.fields key=fieldname item=fieldvalues}
{if count($fieldvalues)}
{if is_array($fieldvalues) && count($fieldvalues)}
<div id="profile-{$profilegroup.id}" class="fieldset-body">
<h5 class="profilefield list-group-item-heading">
{str tag=$fieldname section=artefact.internal}
......
{if count($entrypeerassessments)}
{if is_array($entrypeerassessments) && count($entrypeerassessments)}
<div class="section-import">
<h2>{str tag=peerassessment section=artefact.peerassessment}</h2>
{foreach from=$entrypeerassessments item=peerassessment}
......
......@@ -2,7 +2,7 @@
<h2>{str tag=resume section=artefact.resume}</h2>
<div class="form-group collapsible-group">
{foreach from=$resumegroups item=resumegroup}
{if count($resumegroup.fields)}
{if is_array($resumegroup.fields) && count($resumegroup.fields)}
<fieldset id="{$resumegroup.id}_fs" class="pieform-fieldset collapsible">
<legend>
<h4>
......@@ -14,7 +14,7 @@
</legend>
<div id="resumefield-{$resumegroup.id}" class="collapse list-group">
{foreach from=$resumegroup.fields key=fieldname item=fieldvalues}
{if count(fieldvalues)}
{if is_array($fieldvalues) && count($fieldvalues)}
<div id="resume-{$resumegroup.id}" class="list-group-item">
<h5 class="resumefield" class="list-group-item-heading">
{$fieldname}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment