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

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

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

: $source ?? [];

to:

php

: $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!

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. Thanks!