count(): Parameter must be an array or an object that implements Countable in Importer

Bug #1812910 reported by Robert Lyon on 2019-01-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Status tracked in 19.04
18.04
High
Unassigned
18.10
High
Unassigned
19.04
High
Robert Lyon

Bug Description

Importer needs to use is_array() instead of count() in PHP 7.2 when we are wanting to check if there is an array to loop over with foreach().

Currently we try to loop over entries by checking with count() and we get error

- count(): Parameter must be an array or an object that implements Countable

when there is nothing set

Robert Lyon (robertl-9) on 2019-01-22
Changed in mahara:
importance: Undecided → High
milestone: none → 19.04.0
assignee: nobody → Robert Lyon (robertl-9)
status: New → In Progress

Reviewed: https://reviews.mahara.org/9454
Committed: https://git.mahara.org/mahara/mahara/commit/9b3e36e25f53f3db81f5d643abdc00eec285d148
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: master

commit 9b3e36e25f53f3db81f5d643abdc00eec285d148
Author: Robert Lyon <email address hidden>
Date: Wed Jan 23 09:09:33 2019 +1300

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 <email address hidden>

Reviewed: https://reviews.mahara.org/9483
Committed: https://git.mahara.org/mahara/mahara/commit/745e368f1dff6ea7e5de0a1f636bcf1f36ca1cb3
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: 18.10_STABLE

commit 745e368f1dff6ea7e5de0a1f636bcf1f36ca1cb3
Author: Robert Lyon <email address hidden>
Date: Wed Jan 23 09:09:33 2019 +1300

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 <email address hidden>
(cherry picked from commit 9b3e36e25f53f3db81f5d643abdc00eec285d148)

Reviewed: https://reviews.mahara.org/9484
Committed: https://git.mahara.org/mahara/mahara/commit/6689eadf31b9d3540580d590e3c2e39a3f8fa82a
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: 18.04_STABLE

commit 6689eadf31b9d3540580d590e3c2e39a3f8fa82a
Author: Robert Lyon <email address hidden>
Date: Wed Jan 23 09:09:33 2019 +1300

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 <email address hidden>
(cherry picked from commit 9b3e36e25f53f3db81f5d643abdc00eec285d148)

Robert Lyon (robertl-9) wrote :

There are some more places where this problem occurs so have re-opened the bug and added an new patch to fix the problems

Reviewed: https://reviews.mahara.org/9517
Committed: https://git.mahara.org/mahara/mahara/commit/ef57506f7aed492d6e988d2e62fa9e88e10f7ed6
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit ef57506f7aed492d6e988d2e62fa9e88e10f7ed6
Author: Robert Lyon <email address hidden>
Date: Mon Feb 4 13:30:58 2019 +1300

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

Fixing up some more places, like elasticsearch results, where we are
trying to get a cound on a variable that is not an array

behatnotneeded

Change-Id: I09b809240f18892a187c5e5ed2a3d1756e39b247
Signed-off-by: Robert Lyon <email address hidden>

Mahara Bot (dev-mahara) wrote :

Patch for "18.04_STABLE" branch: https://reviews.mahara.org/9584

Reviewed: https://reviews.mahara.org/9583
Committed: https://git.mahara.org/mahara/mahara/commit/09d059440f3f52352f8ba426cd5af027ee189dbe
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.10_STABLE

commit 09d059440f3f52352f8ba426cd5af027ee189dbe
Author: Robert Lyon <email address hidden>
Date: Mon Feb 4 13:30:58 2019 +1300

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

Fixing up some more places, like elasticsearch results, where we are
trying to get a cound on a variable that is not an array

behatnotneeded

Change-Id: I09b809240f18892a187c5e5ed2a3d1756e39b247
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit ef57506f7aed492d6e988d2e62fa9e88e10f7ed6)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/9584
Committed: https://git.mahara.org/mahara/mahara/commit/98ee2ce6579868400566be8e71c81f943d7317f2
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.04_STABLE

commit 98ee2ce6579868400566be8e71c81f943d7317f2
Author: Robert Lyon <email address hidden>
Date: Mon Feb 4 13:30:58 2019 +1300

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

Fixing up some more places, like elasticsearch results, where we are
trying to get a cound on a variable that is not an array

behatnotneeded

Change-Id: I09b809240f18892a187c5e5ed2a3d1756e39b247
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit ef57506f7aed492d6e988d2e62fa9e88e10f7ed6)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers