Skip to content

Commit

Permalink
Fixed issue #12520: Crash when trying to generate a PDF with Graphs f…
Browse files Browse the repository at this point in the history
…rom statistic page on PHP 7.1 or later
  • Loading branch information
c-schmitz committed May 22, 2018
1 parent 2ce7a2e commit a923906
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions application/third_party/pchart/pChart.class.php
Expand Up @@ -1363,7 +1363,7 @@ function drawArea($Data,$Serie1,$Serie2,$R,$G,$B,$Alpha = 50)

if ( $LastXPos != -1 )
{
$Points = "";
$Points = [];
$Points[] = $LastXPos; $Points[] = $LastYPos1;
$Points[] = $LastXPos; $Points[] = $LastYPos2;
$Points[] = $XPos; $Points[] = $YPos2;
Expand Down Expand Up @@ -1502,15 +1502,15 @@ function drawCubicCurve($Data,$DataDescription,$Accuracy=.1,$SerieName="")
{
if ( $SerieName == "" || $SerieName == $ColName )
{
$XIn = ""; $Yin = ""; $Yt = ""; $U = "";
$XIn = []; $Yin = []; $Yt = []; $U = [];
$XIn[0] = 0; $YIn[0] = 0;

$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }

$Index = 1;
$XLast = -1; $Missing = "";
$XLast = -1; $Missing = [];
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]) )
Expand Down Expand Up @@ -1602,15 +1602,15 @@ function drawFilledCubicCurve($Data,$DataDescription,$Accuracy=.1,$Alpha=100,$Ar
$GraphID = 0;
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$XIn = ""; $Yin = ""; $Yt = ""; $U = "";
$XIn = []; $Yin = []; $Yt = []; $U = [];
$XIn[0] = 0; $YIn[0] = 0;

$ID = 0;
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }

$Index = 1;
$XLast = -1; $Missing = "";
$XLast = -1; $Missing = [];
foreach ( $Data as $Key => $Values )
{
$Value = $Data[$Key][$ColName];
Expand Down Expand Up @@ -1640,7 +1640,7 @@ function drawFilledCubicCurve($Data,$DataDescription,$Accuracy=.1,$Alpha=100,$Ar
for($k=$Index-1;$k>=1;$k--)
$Yt[$k] = $Yt[$k] * $Yt[$k+1] + $U[$k];

$Points = "";
$Points = [];
$Points[] = $this->GAreaXOffset;
$Points[] = $LayerHeight;

Expand Down Expand Up @@ -1675,7 +1675,7 @@ function drawFilledCubicCurve($Data,$DataDescription,$Accuracy=.1,$Alpha=100,$Ar

if ( $YLast != NULL && $AroundZero && !isset($Missing[floor($X)]) && !isset($Missing[floor($X+1)]))
{
$aPoints = "";
$aPoints = [];
$aPoints[] = $XLast;
$aPoints[] = $YLast;
$aPoints[] = $XPos;
Expand Down Expand Up @@ -1712,7 +1712,7 @@ function drawFilledCubicCurve($Data,$DataDescription,$Accuracy=.1,$Alpha=100,$Ar

if ( $YLast != NULL && $AroundZero )
{
$aPoints = "";
$aPoints = [];
$aPoints[] = $XLast;
$aPoints[] = $YLast;
$aPoints[] = $LayerWidth-$this->GAreaXOffset;
Expand Down Expand Up @@ -1771,7 +1771,7 @@ function drawFilledLineGraph($Data,$DataDescription,$Alpha=100,$AroundZero=FALSE
foreach ( $DataDescription["Description"] as $keyI => $ValueI )
{ if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; }

$aPoints = "";
$aPoints = [];
$aPoints[] = $this->GAreaXOffset;
$aPoints[] = $LayerHeight;

Expand Down Expand Up @@ -1813,7 +1813,7 @@ function drawFilledLineGraph($Data,$DataDescription,$Alpha=100,$AroundZero=FALSE

if ($YLast <> $Empty && $AroundZero)
{
$Points = "";
$Points = [];
$Points[] = $XLast; $Points[] = $YLast;
$Points[] = $XPos;
$Points[] = $YPos;
Expand Down Expand Up @@ -1978,7 +1978,7 @@ function drawStackedBarGraph($Data,$DataDescription,$Alpha=50,$Contiguous=FALSE)
$YZero = $this->GArea_Y2 - ((0-$this->VMin) * $this->DivisionRatio);
if ( $YZero > $this->GArea_Y2 ) { $YZero = $this->GArea_Y2; }

$SerieID = 0; $LastValue = "";
$SerieID = 0; $LastValue = [];
foreach ( $DataDescription["Values"] as $Key2 => $ColName )
{
$ID = 0;
Expand Down Expand Up @@ -2116,7 +2116,7 @@ function drawRadarAxis($Data,$DataDescription,$Mosaic=TRUE,$BorderOffset=10,$A_R

if ( $t % 2 == 1 && $LastX1 != -1)
{
$Plots = "";
$Plots = [];
$Plots[] = $X1; $Plots[] = $Y1;
$Plots[] = $X2; $Plots[] = $Y2;
$Plots[] = $LastX2; $Plots[] = $LastY2;
Expand Down Expand Up @@ -2303,7 +2303,7 @@ function drawFilledRadar($Data,$DataDescription,$Alpha=50,$BorderOffset=10,$MaxV

$Angle = -90;
$XLast = -1;
$Plots = "";
$Plots = [];
foreach ( $Data as $Key => $Values )
{
if ( isset($Data[$Key][$ColName]))
Expand Down Expand Up @@ -2378,7 +2378,7 @@ function drawBasicPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawL
$SplicePercent = 100 / $PieSum;

/* Calculate all polygons */
$Angle = 0; $TopPlots = "";
$Angle = 0; $TopPlots = [];
foreach($iValues as $Key => $Value)
{
$TopPlots[$Key][] = $XPos;
Expand Down Expand Up @@ -2496,7 +2496,7 @@ function drawFlatPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLa
$SplicePercent = 100 / $PieSum;

/* Calculate all polygons */
$Angle = 0; $TopPlots = "";
$Angle = 0; $TopPlots = [];
foreach($iValues as $Key => $Value)
{
$XOffset = cos(($Angle+($Value/2*$SpliceRatio)) * 3.1418 / 180 ) * $SpliceDistance;
Expand Down Expand Up @@ -2624,8 +2624,8 @@ function drawPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels

/* Calculate all polygons */
$Angle = 0; $CDev = 5;
$TopPlots = ""; $BotPlots = "";
$aTopPlots = ""; $aBotPlots = "";
$TopPlots = []; $BotPlots = [];
$aTopPlots = []; $aBotPlots = [];
foreach($iValues as $Key => $Value)
{
$XCenterPos = cos(($Angle-$CDev+($Value*$SpliceRatio+$SpliceDistanceRatio)/2) * 3.1418 / 180 ) * $SpliceDistance + $XPos;
Expand Down Expand Up @@ -2707,7 +2707,7 @@ function drawPieGraph($Data,$DataDescription,$XPos,$YPos,$Radius=100,$DrawLabels
foreach($iValues as $Key => $Value)
{
$C_GraphLo = $this->AllocateColor($this->Picture,$this->Palette[$Key]["R"],$this->Palette[$Key]["G"],$this->Palette[$Key]["B"],-10);
$Plots = ""; $Plot = 0;
$Plots = []; $Plot = 0;
foreach($TopPlots[$Key] as $Key2 => $Value2)
{
$Plot++;
Expand Down

0 comments on commit a923906

Please sign in to comment.