I use PHPgraphlib for many years and like that it generates a reliable image instead of some fancy Javascript-stuff. Now since update to PHP7, it renders a log-error on line 926 of the original code:
PHP Warning: count(): Parameter must be an array or object that implements Countable in ./phpgraphlib.php on line 926, referrer ...
From line 926:
protected function displayErrors()
{
if (count($this->error) > 0) {
$lineHeight = 12;
$errorColor = imagecolorallocate($this->image, 0, 0, 0);
$errorBackColor = imagecolorallocate($this->image, 255, 204, 0);
imagefilledrectangle($this->image, 0, 0, $this->width - 1, 2 * $lineHeight, $errorBackColor);
imagestring($this->image, 3, 2, 0, "!!----- PHPGraphLib Error -----!!", $errorColor);
foreach($this->error as $key => $errorText) {
imagefilledrectangle($this->image, 0, ($key * $lineHeight) + $lineHeight, $this->width - 1, ($key * $lineHeight) + 2 * $lineHeight, $errorBackColor);
imagestring($this->image, 2, 2, ($key * $lineHeight) + $lineHeight, "[". ($key + 1) . "] ". $errorText, $errorColor);
}
$errorOutlineColor = imagecolorallocate($this->image, 255, 0, 0);
imagerectangle($this->image, 0, 0, $this->width-1,($key * $lineHeight) + 2 * $lineHeight, $errorOutlineColor);
}
}
I tried to uncomment it, but it throws another error on line 271
//display errors
$this->displayErrors();
I do quite a bit with PHP and MySQL, but this exceeds my amateuer know-how. Any help welcome! Aside this error, phpgraphlib keeps working like a charm. And I use the error, as I couldn't find anything searching for this error on phpgraphlib. References to where answered sure welcome.
Thanks a million!