Repository navigation
Bugfix Issue 586 pChart PHP8 Constructor Fix
CI Agent edited this page Aug 26, 2026
·
1 revision
The pChart library (third_party/pchart/pChart/pChart.class) declared its
constructor using the PHP 4 naming convention:
function pChart($XSize, $YSize)
{
$this->Picture = imagecreatetruecolor($XSize, $YSize);
// ...
}Since PHP 8.0 (deprecated in PHP 7.0), methods named after the class are no
longer treated as constructors. Calling new pChart(900, 400) never executed
the initialization code, leaving $this->Picture as NULL.
Any subsequent draw call (e.g., drawBackground()) triggered:
TypeError: imagecolorallocate(): Argument #1 ($image) must be of type GdImage, null given
This affected all pChart-based chart screens:
topLevelSuitesBarChart.phpkeywordsBarChart.phpoverallPageBarChart.php- Any other screen that instantiates
new pChart(...)
Added a PHP 8-compatible __construct method that delegates to the existing
pChart() method:
/* PHP8-compatible constructor */
function __construct($XSize,$YSize)
{
$this->pChart($XSize,$YSize);
}The old pChart() method is preserved for backward compatibility with any
direct $obj->pChart() calls.
-
third_party/pchart/pChart/pChart.class— +6 lines (construct method + blank line)
- PHP CLI:
new pChart(900,400)now produces a validGdImageobject (not NULL) -
allocateColor(),drawBackground()succeed without TypeError -
php -lsyntax check passes - No regressions in non-chart screens
a60362fa6 on branch fix/issue-586-pchart-constructor