# Bug: ReportSection.php addDataSources() uses undefined variable $source instead of $sources (v30.0.01)

**URL:** <https://ask.gibbonedu.org/t/bug-reportsection-php-adddatasources-uses-undefined-variable-source-instead-of-sources-v30-0-01/15591>\
**Category:** Developers\
**Created:** [July 14, 2026, 8:55pm UTC](https://ask.gibbonedu.org/t/bug-reportsection-php-adddatasources-uses-undefined-variable-source-instead-of-sources-v30-0-01/15591 "2026-07-14T20:55:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xavier\_Bit](https://ask.gibbonedu.org/user_avatar/ask.gibbonedu.org/xavier_bit/32/903_2.png) [@Xavier\_Bit](https://ask.gibbonedu.org/u/Xavier_Bit)\
**Post date:** [July 14, 2026, 8:55pm UTC](https://ask.gibbonedu.org/t/bug-reportsection-php-adddatasources-uses-undefined-variable-source-instead-of-sources-v30-0-01/15591/1 "2026-07-14T20:55:33Z")

</div>

Hi Gibbon Team!  
I already reported a bug in “Administration” and saw that it would fit better here.

**Gibbon version:** v30.0.01  
**PHP version:** 8.3  
**OS:** AlmaLinux (production) / Debian via Docker (development)

**Description:**

In `src/Gibbon/Module/Reports/ReportSection.php`, the `addDataSources()` method contains a typo that causes report data sources to never be registered when passed as an array.

**Affected code (line ~51):**

php

```auto
public function addDataSources($sources)
{
    $sources = is_string($sources)
        ? json_decode($sources) ?? []
        : $source ?? []; // BUG: $source is undefined, should be $sources

```

When `$sources` is already an array (not a JSON string), the else branch uses the undefined variable `$source` instead of `$sources`. PHP silently returns NULL, so the foreach loop receives an empty array and no data sources are registered.

**Impact:**

Custom report card templates using Form Group scope (FormGroupCriteria data source) render completely empty - no grades, no student data. The template appears to load but produces a blank body section. The bug is masked because no PHP error is thrown for undefined variables in this context.

**Fix:**

Change line ~51 from:

php

```auto
: $source ?? [];

```

to:

php

```auto
: $sources ?? [];

```

**Environment:** Gibbon v30.0.01, PHP 8.3, AlmaLinux / Docker on Debian.

I hope this helps and let me know if this isn’t a bug or if you have any questions!

---

<div class="post-metadata">

**Author:** ![Ali](https://ask.gibbonedu.org/user_avatar/ask.gibbonedu.org/ali/32/1024_2.png) [@Ali](https://ask.gibbonedu.org/u/Ali)\
**Post date:** [July 16, 2026, 12:58pm UTC](https://ask.gibbonedu.org/t/bug-reportsection-php-adddatasources-uses-undefined-variable-source-instead-of-sources-v30-0-01/15591/2 "2026-07-16T12:58:39Z")

</div>

Hi @Xavier_Bit

Thank you for reporting the bug. The issue has been fixed in v31. [Reports: fixed a typo bug to return the correct the array by ali-ichk · Pull Request #2132 · GibbonEdu/core · GitHub](https://github.com/GibbonEdu/core/pull/2132). Thanks!
