One of the changes in PHP 8 is that a constructor must look like: __construct()
. You cannot simply use the name of the class, like, say, Java.
pChart 2.1.4 was still using class names as constructor.
Example, in pPie.class.php, the constructor was:
function pPie($Object, $pDataObject) {......}
I had to change it to:
function __construct($Object, $pDataObject) {....}
Also, all of the public variables in the class were defined using the var
keyword, which is deprecated. Though not required at this time, I changed them to public
.
Finally, I noticed that some of the public variables had initial values that didn't match up to what they actually were. Again, maybe not required, but just to be safe, I set them to null
.
For example:
Originally, class pPie had these variables:
var $pChartObject = array();
var $pDataObject = array();
var $LabelPos = "";
I changed them to:
public $pChartObject = null;
public $pDataObject = null;
public $LabelPos = "";
You will need to make similar changes (primarily the __construct() change) to all of the .class.php files that come with pChart.