From: Christian Bayle <bayle@debian.org>
Date: Tue, 25 Feb 2025 14:49:41 +0100
Subject: Replace static call not supported in newer php

Forwarded: not-needed
---
 src/jpgraph.php         | 134 ++++++++++++++++++++++++------------------------
 src/jpgraph_gantt.php   |  20 ++++----
 src/jpgraph_line.php    |   2 +-
 src/jpgraph_pie.php     |   8 +--
 src/jpgraph_pie3d.php   |   4 +-
 src/jpgraph_scatter.php |   2 +-
 src/jpgraph_spider.php  |  16 +++---
 7 files changed, 93 insertions(+), 93 deletions(-)

diff --git a/src/jpgraph.php b/src/jpgraph.php
index 1dbee4f..56b08f7 100644
--- a/src/jpgraph.php
+++ b/src/jpgraph.php
@@ -240,7 +240,7 @@ class JpGraphError {
 //
 // ... and install the default error handler
 //
-JpGraphError::Install("JpGraphErrObject");
+(new JpGraphError())->Install("JpGraphErrObject");
 
 //
 //Check if there were any warnings, perhaps some wrong includes by the
@@ -249,7 +249,7 @@ JpGraphError::Install("JpGraphErrObject");
 if( isset($GLOBALS['php_errormsg']) ) {
     // Disabled by Debian to prevent showing PHP5 warnings
     // ("Non-static method called statically")
-    // JpGraphError::Raise("<b>General PHP error:</b><br>".$GLOBALS['php_errormsg']);
+    // (new JpGraphError())->Raise("<b>General PHP error:</b><br>".$GLOBALS['php_errormsg']);
 }
 
 //
@@ -263,7 +263,7 @@ if(function_exists('imagecopyresampled') ) {
     $GLOBALS['gd2'] = false;
 }
 else {
-    JpGraphError::Raise("<b>JpGraph Error:</b> Your PHP installation does not 
+    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Your PHP installation does not 
 	have the required GD library.
 	Please see the PHP documentation on how to install and enable the GD library.");
 }
@@ -286,7 +286,7 @@ function GenImgName() {
     elseif( $supported & IMG_JPG )
 	$img_format="jpeg";
     if( !isset($_SERVER['PHP_SELF']) )
-	JpGraphError::Raise("<b>JpGraph Error:</b> Can't access PHP_SELF, PHP global variable. You can't run PHP from command line
+	(new JpGraphError())->Raise("<b>JpGraph Error:</b> Can't access PHP_SELF, PHP global variable. You can't run PHP from command line
 		if you want to use the 'auto' naming of cache or image files.");
     $fname=basename($_SERVER['PHP_SELF']);
     // Replace the ".php" extension with the image format extension
@@ -449,21 +449,21 @@ class Graph {
     // Add a plot object to the graph
     function Add(&$aPlot) {
 	if( $aPlot == null )
-	    JpGraphError::Raise("<b><b>JpGraph Error:</b></b> Graph::Add() You tried to add a null plot to the graph.");				
+	    (new JpGraphError())->Raise("<b><b>JpGraph Error:</b></b> Graph::Add() You tried to add a null plot to the graph.");				
 	$this->plots[] = &$aPlot;
     }
 	
     // Add plot to second Y-scale
     function AddY2(&$aPlot) {
 	if( $aPlot == null )
-	    JpGraphError::Raise("<b><b>JpGraph Error:</b></b> Graph::AddY2() You tried to add a null plot to the graph.");				
+	    (new JpGraphError())->Raise("<b><b>JpGraph Error:</b></b> Graph::AddY2() You tried to add a null plot to the graph.");				
 	$this->y2plots[] = &$aPlot;
     }
 	
     // Add text object to the graph
     function AddText(&$aTxt) {
 	if( $aTxt == null )
-	    JpGraphError::Raise("<b><b>JpGraph Error:</b></b> Graph::AddText() You tried to add a null text to the graph.");		
+	    (new JpGraphError())->Raise("<b><b>JpGraph Error:</b></b> Graph::AddText() You tried to add a null text to the graph.");		
 	if( is_array($aTxt) ) {
 	    for($i=0; $i<count($aTxt); ++$i )
 		$this->texts[]=&$aTxt[$i];
@@ -475,7 +475,7 @@ class Graph {
     // Add a line object (class PlotLine) to the graph
     function AddLine(&$aLine) {
 	if( $aLine == null )
-	    JpGraphError::Raise("<b><b>JpGraph Error:</b></b> Graph::AddLine() You tried to add a null line to the graph.");		
+	    (new JpGraphError())->Raise("<b><b>JpGraph Error:</b></b> Graph::AddLine() You tried to add a null line to the graph.");		
 	if( is_array($aLine) ) {
 	    for($i=0; $i<count($aLine); ++$i )
 		$this->lines[]=&$aLine[$i];
@@ -487,7 +487,7 @@ class Graph {
     // Add vertical or horizontal band
     function AddBand(&$aBand) {
 	if( $aBand == null )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Graph::AddBand() You tried to add a null band to the graph.");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Graph::AddBand() You tried to add a null band to the graph.");
 	if( is_array($aBand) ) {
 	    for($i=0; $i<count($aBand); ++$i )
 		$this->bands[] = &$aBand[$i];
@@ -503,7 +503,7 @@ class Graph {
 /* CB Not any more bugging
 
 	if( $GLOBALS["gd2"] && !USE_TRUECOLOR ) {
-	    JpGraphError::Raise("<b>JpGraph Error:</b>You are using GD 2.x and are 
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b>You are using GD 2.x and are 
 trying to use a background images on a non truecolor image. <br>
 To use
 background images with GD 2.x you <b>must</b> enable truecolor by setting the
@@ -579,7 +579,7 @@ poor quality fonts.");
 	elseif( $yt=="log" )
 	    $this->yscale = new LogScale($aYMin,$aYMax);
 	else
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Unknown scale specification for Y-scale. ($axtype)");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown scale specification for Y-scale. ($axtype)");
 			
 	$xt=substr($aAxisType,0,3);
 	if( $xt == "lin" || $xt == "tex" )
@@ -591,7 +591,7 @@ poor quality fonts.");
 	elseif( $xt == "log" )
 	    $this->xscale = new LogScale($aXMin,$aXMax,"x");
 	else
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Unknown scale specification for X-scale. ($aAxisType)");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown scale specification for X-scale. ($aAxisType)");
 
 	$this->xscale->Init($this->img);
 	$this->yscale->Init($this->img);						
@@ -610,7 +610,7 @@ poor quality fonts.");
 	elseif( $aAxisType=="log" ) {
 	    $this->y2scale = new LogScale($aY2Min,$aY2Max);
 	}
-	else JpGraphError::Raise("JpGraph: Unsupported Y2 axis type: $axtype<br>");
+	else (new JpGraphError())->Raise("JpGraph: Unsupported Y2 axis type: $axtype<br>");
 			
 	$this->y2scale->Init($this->img);	
 	$this->y2axis = new Axis($this->img,$this->y2scale);
@@ -642,7 +642,7 @@ poor quality fonts.");
 		$this->ytick_factor=100;			
 	    break;		
 	    default:
-		JpGraphError::Raise("JpGraph: Unsupported Tick density: $densy");
+		(new JpGraphError())->Raise("JpGraph: Unsupported Tick density: $densy");
 	}
 	switch( $aXDensity ) {
 	    case TICKD_DENSE:
@@ -658,7 +658,7 @@ poor quality fonts.");
 		$this->xtick_factor=60;								
 	    break;		
 	    default:
-		JpGraphError::Raise("JpGraph: Unsupported Tick density: $densx");
+		(new JpGraphError())->Raise("JpGraph: Unsupported Tick density: $densx");
 	}		
     }
 	
@@ -705,7 +705,7 @@ poor quality fonts.");
 	// scaling you also have to supply the tick steps as well.
 	if( (!$this->yscale->IsSpecified() && count($this->plots)==0) ||
 	    ($this->y2scale!=null && !$this->y2scale->IsSpecified() && count($this->y2plots)==0) ) {
-	    JpGraphError::Raise("<strong>JpGraph: Can't draw unspecified Y-scale.</strong><br>
+	    (new JpGraphError())->Raise("<strong>JpGraph: Can't draw unspecified Y-scale.</strong><br>
 				You have either:
 				<br>* Specified an Y axis for autoscaling but have not supplied any plots
 				<br>* Specified a scale manually but have forgot to specify the tick steps");
@@ -713,7 +713,7 @@ poor quality fonts.");
 		
 	// Bail out if no plots and no specified X-scale
 	if( (!$this->xscale->IsSpecified() && count($this->plots)==0 && count($this->y2plots)==0) )
-	    JpGraphError::Raise("<strong>JpGraph: Can't draw unspecified X-scale.</strong><br>No plots.<br>");
+	    (new JpGraphError())->Raise("<strong>JpGraph: Can't draw unspecified X-scale.</strong><br>No plots.<br>");
 
 	//Check if we should autoscale y-axis
 	if( !$this->yscale->IsSpecified() && count($this->plots)>0 ) {
@@ -877,11 +877,11 @@ poor quality fonts.");
 	if( $aImgFormat == "jpeg" )
 	    $imgtag = "jpg";
 	if( !strstr($this->background_image,$imgtag) && strstr($this->background_image,".") )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Background image seems to be of different type (has different file extension)
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Background image seems to be of different type (has different file extension)
 			than specified imagetype. <br>Specified: '".$aImgFormat."'<br>File: '".$this->background_image."'");
 	$img = $f($this->background_image);
 	if( !$img ) {
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Can't read background image: '".$this->background_image."'");   
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Can't read background image: '".$this->background_image."'");   
 	}
 	return $img;
     }	
@@ -933,7 +933,7 @@ poor quality fonts.");
 		$this->StrokeFrame();
 		break;
 		default:
-		    JpGraphError::Raise("<b>JpGraph Error:</b> Unknown background image layout");
+		    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown background image layout");
 	    }			
 	    $this->img->SetAngle($aa);										  			
 	}
@@ -1110,7 +1110,7 @@ class TTF {
     // Create the TTF file from the font specification
     function File($fam,$style=FS_NORMAL) {
 	$f=$this->font_fam[$fam];
-	if( !$f ) JpGraphError::Raise("<b>JpGraph Error:</b> Unknown TTF font family.");
+	if( !$f ) (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown TTF font family.");
 	switch( $style ) {
 	    case FS_NORMAL:
 		break;
@@ -1121,13 +1121,13 @@ class TTF {
 	    case FS_BOLDIT: $f .= "BdIt";
 		break;
 	    default:
-		JpGraphError::Raise("<b>JpGraph Error:</b> Unknown TTF Style.");
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown TTF Style.");
 	}
 	$f .= ".ttf";
 		
 	// Check that file exist
 	if( !file_exists($f) ) 
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Can't open font file \"$f\". Wrong directory?");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Can't open font file \"$f\". Wrong directory?");
 		
 	return $f;
     }
@@ -1269,7 +1269,7 @@ class Text {
 	    $this->dir = 0;
 	elseif( $aDirection=="v" )
 	    $this->dir = 90;
-	else JpGraphError::Raise("<b>JpGraph Error:</b> Invalid direction specified for text.");
+	else (new JpGraphError())->Raise("<b>JpGraph Error:</b> Invalid direction specified for text.");
     }
 	
     // Total width of text
@@ -1520,7 +1520,7 @@ class Axis {
     // at $start
     // DEPRECATED FUNCTION: USE SetTextTickInterval() INSTEAD
     function SetTextTicks($step,$start=0) {
-	JpGraphError::Raise("<b>JpGraph Error:</b> SetTextTicks() is deprecated. Use SetTextTickInterval() instead.");		
+	(new JpGraphError())->Raise("<b>JpGraph Error:</b> SetTextTicks() is deprecated. Use SetTextTickInterval() instead.");		
     }
 
     // Specify that every $step of the ticks should be displayed starting
@@ -1534,7 +1534,7 @@ class Axis {
     // should be displayed starting
     function SetTextLabelInterval($aStep) {
 	if( $aStep < 1 )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Text label interval must be specified >= 1.");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Text label interval must be specified >= 1.");
 	$this->label_step=$aStep;
     }
 	
@@ -1677,7 +1677,7 @@ class Axis {
 		else {
 		    // scale->type == "y"
 		    if( $this->label_angle!=0 ) 
-			JpGraphError::Raise("<b>JpGraph Error:</b> Labels at an angle are not supported on Y-axis");
+			(new JpGraphError())->Raise("<b>JpGraph Error:</b> Labels at an angle are not supported on Y-axis");
 		    if( $this->labelPos == 0 ) { // To the left of y-axis					
 			$this->img->SetTextAlign("right","center");
 			$this->img->StrokeText($aPos-$this->tick_label_margin,$tpos,$label);					
@@ -1838,7 +1838,7 @@ class LinearTicks extends Ticks {
     // Set Minor and Major ticks (in world coordinates)
     function Set($aMajStep,$aMinStep) {
 	if( $aMajStep <= 0 || $aMinStep <= 0 ) {
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Minor or major step size is 0. Check that you haven't
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Minor or major step size is 0. Check that you haven't
 				got an accidental SetTextTicks(0) in your code.<p>
 				If this is not the case you might have stumbled upon a bug in JpGraph.
 				Please report this and if possible include the data that caused the
@@ -1856,7 +1856,7 @@ class LinearTicks extends Ticks {
 	$min_step_abs = $scale->scale_factor*$this->minor_step;		
 
 	if( $min_step_abs==0 || $maj_step_abs==0 ) 
-	    JpGraphError::Raise("<b>JpGraph Error:</b> A plot has an illegal scale. This could for example be 
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> A plot has an illegal scale. This could for example be 
 			that you are trying to use text autoscaling to draw a line plot with only one point 
 			or similair abnormality (a line needs two points!).");
 	$limit = $scale->scale_abs[1];	
@@ -2077,7 +2077,7 @@ class LinearScale {
     // Specify scale "grace" value (top and bottom)
     function SetGrace($aGraceTop,$aGraceBottom=0) {
 	if( $aGraceTop<0 || $aGraceBottom < 0  )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Grace must be larger then 0");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Grace must be larger then 0");
 	$this->gracetop=$aGraceTop;
 	$this->gracebottom=$aGraceBottom;
     }
@@ -2293,7 +2293,7 @@ class LinearScale {
 	$this->off=$aStart;
 		
 	if( $this->world_size<=0 ) {
-	    JpGraphError::Raise("<b>JpGraph Fatal Error</b>:<br>
+	    (new JpGraphError())->Raise("<b>JpGraph Fatal Error</b>:<br>
 		 You have unfortunately stumbled upon a bug in JpGraph. <br>
 		 It seems like the scale range is ".$this->world_size." [for ".
 		 $this->type." scale] <br>
@@ -2878,7 +2878,7 @@ class RGB {
 			     $adj*hexdec(substr($aColor, 5, 2)));
 	    } else {
       		if(!isset($this->rgb_table[$aColor]) )
-		    JpGraphError::Raise("<b>JpGraph Error:</b> Unknown color: <strong>$aColor</strong>");
+		    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown color: <strong>$aColor</strong>");
 		$tmp=$this->rgb_table[$aColor];
 		return array($adj*$tmp[0],$adj*$tmp[1],$adj*$tmp[2]);
 	    }
@@ -2886,7 +2886,7 @@ class RGB {
 	    return $aColor;
 	}
 	else
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Unknown color specification: $aColor , size=".count($aColor));
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown color specification: $aColor , size=".count($aColor));
     }
 	
     // Compare two colors
@@ -2948,7 +2948,7 @@ class Image {
     function Image($aWidth,$aHeight,$aFormat=DEFAULT_GFORMAT) {
 	$this->CreateImgCanvas($aWidth,$aHeight);
 	if( !$this->SetImgFormat($aFormat) ) {
-	    JpGraphError::Raise("JpGraph: Selected graphic format is either not supported or unknown [$aFormat]");
+	    (new JpGraphError())->Raise("JpGraph: Selected graphic format is either not supported or unknown [$aFormat]");
 	}
 	$this->ttf = new TTF();
     }
@@ -3015,7 +3015,7 @@ class Image {
 	
     function SetFont($family,$style=FS_NORMAL,$size=10) {
 	if($family==FONT1_BOLD || $family==FONT2_BOLD || $family==FONT0 || $family==FONT1 || $family==FONT2 )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Usage of FONT0, FONT1, FONT2 is deprecated. Use FF_xxx instead.");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Usage of FONT0, FONT1, FONT2 is deprecated. Use FF_xxx instead.");
 		
 	$this->font_family=$family;
 	$this->font_style=$style;
@@ -3089,7 +3089,7 @@ class Image {
 	if( !is_numeric($dir) ) {
 	    if( $dir=="h" ) $dir=0;
 	    elseif( $dir=="v" ) $dir=90;
-	    else JpGraphError::Raise("<b>JpGraph Error:</b> Unknown direction specified in call to StrokeBoxedText() [$dir]");
+	    else (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown direction specified in call to StrokeBoxedText() [$dir]");
 	}
 		
 	$width=$this->GetTextWidth($txt,$dir);
@@ -3156,11 +3156,11 @@ class Image {
 	    $txt = LanguageConv::ToCyrillic($txt);
 
 	if( !is_numeric($dir) )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Direction for text most be given as an angle between 0 and 90.");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Direction for text most be given as an angle between 0 and 90.");
 			
 	if( $this->font_family >= FF_FONT0 && $this->font_family <= FF_FONT2+1) {	// Internal font
 	    if( is_numeric($dir) && $dir!=90 && $dir!=0) 
-		JpGraphError::Raise("<b>JpGraph Error:</b> Internal font does not support drawing text at arbitrary angle. Use TTF fonts instead.");
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b> Internal font does not support drawing text at arbitrary angle. Use TTF fonts instead.");
 
 	    $h=$this->GetTextHeight($txt);
 	    $fh=$this->GetFontHeight($txt);
@@ -3226,7 +3226,7 @@ class Image {
 	    }
 	}
 	else
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Unknown font family specification: ". $this->font_family);
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown font family specification: ". $this->font_family);
     }
 	
     function SetMargin($lm,$rm,$tm,$bm) {
@@ -3248,7 +3248,7 @@ class Image {
 	$this->current_color=$this->rgb->allocate($color);
 	if( $this->current_color == -1 ) {
 	    $tc=imagecolorstotal($this->img);
-	    JpGraphError::Raise("<b><b>JpGraph Error:</b> Can't allocate any more colors.</b><br>
+	    (new JpGraphError())->Raise("<b><b>JpGraph Error:</b> Can't allocate any more colors.</b><br>
 				Image has already allocated maximum of <b>$tc colors</b>. 
 				This might happen if you have anti-aliasing turned on
 				together with a background image or perhaps gradient fill 
@@ -3283,7 +3283,7 @@ DEFINE(\"USE_APPROX_COLORS\",true);
 	
     function PopColor() {
 	if($this->colorstackidx<0)
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Negative Color stack index. Unmatched call to PopColor()");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Negative Color stack index. Unmatched call to PopColor()");
 	$this->current_color=$this->colorstack[--$this->colorstackidx];
 	$this->current_color_name=$this->colorstack[--$this->colorstackidx];
     }
@@ -3310,7 +3310,7 @@ DEFINE(\"USE_APPROX_COLORS\",true);
     }
     function _AdjBrightContrast($img,$bright,$contr=0) {
 	if( $bright < -1 || $bright > 1 || $contr < -1 || $contr > 1 )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Parameters for brightness and Contrast out of range [-1,1]");		
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Parameters for brightness and Contrast out of range [-1,1]");		
 	$nbr = imagecolorstotal ($img);
 	for( $i=0; $i<$nbr; ++$i ) {
 	    $colarr = imagecolorsforindex ($img,$i);
@@ -3411,7 +3411,7 @@ DEFINE(\"USE_APPROX_COLORS\",true);
     
     function FilledArc($cx,$cy,$w,$h,$s,$e) {
 	if( $GLOBALS['gd2'] == false ) {
-	    JpGraphError::Raise("<b>JpGraph Error:</b> This plot type requires GD 2.x or later");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> This plot type requires GD 2.x or later");
 	    die();
 	}
 	imagefilledarc($this->img,$cx,$cy,$w,$h,$s,$e,$this->current_color,IMG_ARC_PIE);
@@ -3588,16 +3588,16 @@ DEFINE(\"USE_APPROX_COLORS\",true);
     function SetLineStyle($s) {
 	if( is_numeric($s) ) {
 	    if( $s<1 || $s>4 ) 
-		JpGraphError::Raise("<b>JpGraph Error:</b> Illegal numeric argument to SetLineStyle(): $s");
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b> Illegal numeric argument to SetLineStyle(): $s");
 	}
 	elseif( is_string($s) ) {
 	    if( $s == "solid" ) $s=1;
 	    elseif( $s == "dotted" ) $s=2;
 	    elseif( $s == "dashed" ) $s=3;
 	    elseif( $s == "longdashed" ) $s=4;
-	    else JpGraphError::Raise("<b>JpGraph Error:</b> Illegal string argument to SetLineStyle(): $s");
+	    else (new JpGraphError())->Raise("<b>JpGraph Error:</b> Illegal string argument to SetLineStyle(): $s");
 	}
-	else JpGraphError::Raise("<b>JpGraph Error:</b> Illegal argument to SetLineStyle $s");
+	else (new JpGraphError())->Raise("<b>JpGraph Error:</b> Illegal argument to SetLineStyle $s");
 	$this->line_style=$s;
     }
 	
@@ -3617,7 +3617,7 @@ DEFINE(\"USE_APPROX_COLORS\",true);
 		$this->DashedLine($x1,$y1,$x2,$y2,8,6);
 	    break;
 	    default:
-		JpGraphError::Raise("<b>JpGraph Error:</b> Unknown line style: $this->line_style ");
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown line style: $this->line_style ");
 		break;
 	}
     }
@@ -3785,7 +3785,7 @@ DEFINE(\"USE_APPROX_COLORS\",true);
 		$res = @$func($this->img);
 	}
 	if( !$res )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Can't create or stream image to file: $aFile<br>
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Can't create or stream image to file: $aFile<br>
 Check that PHP has enough permission to write a file to the current directory.");
     }
 		
@@ -3808,7 +3808,7 @@ Check that PHP has enough permission to write a file to the current directory.")
 	    elseif( $supported & IMG_GIF )
 		$this->img_format="gif";
 	    else
-		JpGraphError::Raise("<b>JpGraph Error:</b> Your PHP (and GD-lib) installation does not appear to support any known graphic formats.".
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b> Your PHP (and GD-lib) installation does not appear to support any known graphic formats.".
 		    "You need to first make sure GD is compiled as a module to PHP. If you also want to use JPEG images".
 		    "you must get the JPEG library. Please see the PHP docs for details.");
 				
@@ -3830,7 +3830,7 @@ Check that PHP has enough permission to write a file to the current directory.")
 	    else 
 		$tst=false;
 	    if( !$tst )
-		JpGraphError::Raise("<b>JpGraph Error:</b> Your PHP installation does not support the chosen graphic format: $aFormat");
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b> Your PHP installation does not support the chosen graphic format: $aFormat");
 	}
     }	
 } // CLASS
@@ -4032,12 +4032,12 @@ class ImgStreamCache {
 		    // then do nothing, just return.
 		    $diff=time()-filemtime($aCacheFileName);
 		    if( $diff < 0 )
-			JpGraphError::Raise("<b>JpGraph Error:</b> Cached imagefile ($aCacheFileName) has file date in the future!!");
+			(new JpGraphError())->Raise("<b>JpGraph Error:</b> Cached imagefile ($aCacheFileName) has file date in the future!!");
 		    if( $this->timeout>0 && ($diff <= $this->timeout*60) ) 
 			return;		
 		}			
 		if( !@unlink($aCacheFileName) )
-		    JpGraphError::Raise("<b>JpGraph Error:</b> ZZZZ Can't delete cached image $aStrokeFileName. Permission problem?");
+		    (new JpGraphError())->Raise("<b>JpGraph Error:</b> ZZZZ Can't delete cached image $aStrokeFileName. Permission problem?");
 		$aImage->Stream($aCacheFileName);	
 	    }
 	    else {
@@ -4052,7 +4052,7 @@ class ImgStreamCache {
 	    if( CACHE_FILE_MOD != "" )
 		$res = @chmod($aCacheFileName,CACHE_FILE_MOD);
 	    if( !$res )
-		JpGraphError::Raise("<b>JpGraph Error:</b> Can't set permission for cached image $aStrokeFileName. Permission problem?");
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b> Can't set permission for cached image $aStrokeFileName. Permission problem?");
 			
 	    $aImage->Destroy();
 	    if( $aInline ) {
@@ -4062,7 +4062,7 @@ class ImgStreamCache {
 		    return;
 		}
 		else
-		    JpGraphError::Raise("<b>JpGraph Error:</b> Cant open file from cache [$aFile]"); 
+		    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Cant open file from cache [$aFile]"); 
 	    }
 	}
 	elseif( $aInline ) {
@@ -4090,7 +4090,7 @@ class ImgStreamCache {
 		    return true;
 		}
 		else
-		    JpGraphError::Raise("<b>JpGraph Error:</b> Can't open cached image \"$aCacheFileName\" for reading.");
+		    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Can't open cached image \"$aCacheFileName\" for reading.");
 	    }
 	} 
 	return false;
@@ -4107,7 +4107,7 @@ class ImgStreamCache {
 	}
 	for ($i = sizeof($dirs)-1; $i>=0; $i--) {
 	    if(! @mkdir($dirs[$i],0777) )
-		JpGraphError::Raise("<b>JpGraph Error:</b> Can't create directory in $aFile. Permission problems?");
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b> Can't create directory in $aFile. Permission problems?");
 				
 	    // We also specify mode here after we have changed group. 
 	    // This is necessary if Apache user doesn't belong the
@@ -4118,7 +4118,7 @@ class ImgStreamCache {
 		$res =@chgrp($dirs[$i],CACHE_FILE_GROUP);
 		$res &= @chmod($dirs[$i],0777);
 		if( !$res )
-		    JpGraphError::Raise("<b>JpGraph Error:</b> Can't set permissions for $aFile. Permission problems?");
+		    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Can't set permissions for $aFile. Permission problems?");
 	    }
 	}
 	return true;
@@ -4177,7 +4177,7 @@ class Legend {
 	
     function Pos($aX,$aY,$aHAlign="right",$aVAlign="top") {
 	if( !($aX<1 && $aY<1) )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Position for legend must be given as percentage in range 0-1");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Position for legend must be given as percentage in range 0-1");
 	$this->xpos=$aX;
 	$this->ypos=$aY;
 	$this->halign=$aHAlign;
@@ -4185,7 +4185,7 @@ class Legend {
     }
 
     function SetBackground($aDummy) {
-	JpGraphError::Raise("<b>JpGraph Error:</b> Deprecated function Legend::SetBaqckground() use Legend::SetFillColor() instead.");
+	(new JpGraphError())->Raise("<b>JpGraph Error:</b> Deprecated function Legend::SetBaqckground() use Legend::SetFillColor() instead.");
     }
 
     function SetFillColor($aColor) {
@@ -4288,7 +4288,7 @@ class Plot {
     function Plot(&$aDatay,$aDatax=false) {
 	$this->numpoints = count($aDatay);
 	if( $this->numpoints==0 )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Empty data array specified for plot. Must have at least one data point.");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Empty data array specified for plot. Must have at least one data point.");
 	$this->coords[0]=$aDatay;
 	if( is_array($aDatax) )
 	    $this->coords[1]=$aDatax;
@@ -4301,7 +4301,7 @@ class Plot {
     // "virtual" function which must be implemented by
     // the subclasses
     function Stroke(&$aImg,&$aXScale,&$aYScale) {
-	JpGraphError::Raise("JpGraph: Stroke() must be implemented by concrete subclass to class Plot");
+	(new JpGraphError())->Raise("JpGraph: Stroke() must be implemented by concrete subclass to class Plot");
     }
 	
     // Set href targets for CSIM	
@@ -4319,7 +4319,7 @@ class Plot {
     // or axis are stroked used to do any plot specific adjustment
     function PreStrokeAdjust(&$aGraph) {
 	if( substr($aGraph->axtype,0,4) == "text" && (isset($this->coords[1])) )
-	    JpGraphError::Raise("JpGraph: You can't use a text X-scale with specified X-coords. Use a \"int\" or \"lin\" scale instead.");
+	    (new JpGraphError())->Raise("JpGraph: You can't use a text X-scale with specified X-coords. Use a \"int\" or \"lin\" scale instead.");
 	return true;	
     }
 	
@@ -4371,7 +4371,7 @@ class Plot {
 	    if( !isset($y[0]) ) {
 		$y[0] = 0;
 // Change in 1.5.1 Don't treat this as an error any more. Just silently concert to 0
-//		JpGraphError::Raise("<b>JpGraph Error:</b> You have not specified a y[0] value!!");
+//		(new JpGraphError())->Raise("<b>JpGraph Error:</b> You have not specified a y[0] value!!");
 	    }
 	    $cnt = count($y);
 	    $i=0;
@@ -4596,7 +4596,7 @@ class RectPattern {
 
     function SetDensity($aDens) {
 	if( $aDens <1 || $aDens > 100 )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Desity for pattern must be between 1 and 100. (You tried $aDens)");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Desity for pattern must be between 1 and 100. (You tried $aDens)");
 	// 1% corresponds to linespacing=50
 	// 100 % corresponds to linespacing 1
 	$this->linespacing = floor(((100-$aDens)/100.0)*50)+1;
@@ -4605,7 +4605,7 @@ class RectPattern {
 
     function Stroke(&$aImg) {
 	if( $this->rect == null )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> No positions specified for pattern.");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> No positions specified for pattern.");
 
 	if( !(is_numeric($this->iBackgroundColor) && $this->iBackgroundColor==-1) ) {
 	    $aImg->SetColor($this->iBackgroundColor);
@@ -5016,7 +5016,7 @@ class RectPatternFactory {
 		$obj =  new RectPatternDiagCross($aColor,$aWeight);
 	    break;
 	    default:
-		JpGraphError::Raise("<b>JpGraph Error:</b> Unknown pattern specification ($aPattern)");
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown pattern specification ($aPattern)");
 	}
 	return $obj;
     }
@@ -5155,7 +5155,7 @@ class PlotLine {
 	    $aImg->Line($xmin_abs, $ypos_abs, $xmax_abs, $ypos_abs);
 	}
 	else
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Illegal direction for static line");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Illegal direction for static line");
     }
 }
 
diff --git a/src/jpgraph_gantt.php b/src/jpgraph_gantt.php
index 2e7263e..f251e12 100644
--- a/src/jpgraph_gantt.php
+++ b/src/jpgraph_gantt.php
@@ -82,7 +82,7 @@ class DateLocale {
 // PUBLIC METHODS	
     function Set($aLocale) {
 	if( $aLocale < LOCALE_EN || $aLocale > LOCALE_SE )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Unsupported locale ($aLocale)");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unsupported locale ($aLocale)");
 	$this->iLocale = $aLocale;
     }
 	
@@ -159,7 +159,7 @@ class GanttGraph extends Graph {
 
     // Override inherit method from Graph and give a warning message
     function SetScale() {
-	JpGraphError::Raise("<b>JpGraph Error:</b> SetScale() is not meaningfull with Gantt charts.");
+	(new JpGraphError())->Raise("<b>JpGraph Error:</b> SetScale() is not meaningfull with Gantt charts.");
 	// Empty
     }
 
@@ -794,7 +794,7 @@ class GanttScale {
 	$aDate = $this->NormalizeDate($aDate);
 	$img=$this->iImg;		
 	if( $aDate < $this->iStartDate || $aDate > $this->iEndDate )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Date is outside specified scale range.");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Date is outside specified scale range.");
 	return ($aDate-$this->iStartDate)/SECPERDAY*$this->GetDayWidth()+$img->left_margin+$this->iLabelWidth;;
     }
 
@@ -803,7 +803,7 @@ class GanttScale {
 	$img=$this->iImg;
 	$ph=$this->iAvailableHeight;
 	if( $aPos > $this->iVertLines ) 
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Illegal vertical position $aPos");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Illegal vertical position $aPos");
 	if( $this->iVertLayout == GANTT_EVEN ) {
 	    // Position the top bar at 1 vert spacing from the scale
 	    return round($img->top_margin + $this->iVertHeaderSize +  ($aPos+1)*$this->iVertSpacing);
@@ -826,7 +826,7 @@ class GanttScale {
 	elseif( is_int($aDate) || is_float($aDate) )
 	    return $aDate;
 	else
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Unknown date format in GanttScale ($aDate).");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Unknown date format in GanttScale ($aDate).");
     }
 
     // Stroke the day scale (including gridlines)			
@@ -902,7 +902,7 @@ class GanttScale {
 		$txtOffset = 2;
 	    }
 	    else
-		JpGraphError::Raise("<b>JpGraph Error:</b>Unknown formatting style for week.");
+		(new JpGraphError())->Raise("<b>JpGraph Error:</b>Unknown formatting style for week.");
 				
 	    for($i=0; $i<$this->GetNumberOfDays()/7; ++$i, $x+=$weekwidth) {
 		$img->PushColor($this->week->iTextColor);
@@ -1101,7 +1101,7 @@ class GanttScale {
     // Main entry point to stroke scale
     function Stroke() {
 	if( !$this->IsRangeSet() )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Gantt scale has not been specified.");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Gantt scale has not been specified.");
 	$img=$this->iImg;
 		
 	// Stroke all headers. Aa argument we supply the offset from the
@@ -1185,7 +1185,7 @@ class Progress {
 	
     function Set($aProg) {
 	if( $aProg < 0.0 || $aProg > 1.0 )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Progress value must in range [0, 1]");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Progress value must in range [0, 1]");
 	$this->iProgress = $aProg;
     }
 
@@ -1292,7 +1292,7 @@ class GanttBar extends GanttPlotObject {
 	elseif(is_int($this->iHeightFactor) && $this->iHeightFactor>2 && $this->iHeightFactor<200)
 	    $vs = $this->iHeightFactor;
 	else
-	    JpGraphError::Raise("<b>JpGraph Error:</b>Specified height (".$this->iHeightFactor.") for gantt bar is out of range.");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b>Specified height (".$this->iHeightFactor.") for gantt bar is out of range.");
 			
 	$xt = $aScale->TranslateDate($aScale->NormalizeDate($this->iStart));
 	$xb = $aScale->TranslateDate($aScale->NormalizeDate($this->iEnd));
@@ -1413,7 +1413,7 @@ class GanttVLine extends GanttPlotObject {
 
     function SetDayOffset($aOff=0.5) {
 	if( $aOff < 0.0 || $aOff > 1.0 )
-	    JpGraphError::Raise("<b>JpGraph Error:</b> Offset for vertical line must be in range [0,1]");
+	    (new JpGraphError())->Raise("<b>JpGraph Error:</b> Offset for vertical line must be in range [0,1]");
 	$this->iDayOffset = $aOff;
     }
 	
diff --git a/src/jpgraph_line.php b/src/jpgraph_line.php
index 9012eda..9a21dcd 100644
--- a/src/jpgraph_line.php
+++ b/src/jpgraph_line.php
@@ -124,7 +124,7 @@ class LinePlot extends Plot{
 	$numpoints=count($this->coords[0]);
 	if( isset($this->coords[1]) ) {
 	    if( count($this->coords[1])!=$numpoints )
-		JpGraphError::Raise("JpGraph Error: Number of X and Y points are not equal.<br>
+		(new JpGraphError())->Raise("JpGraph Error: Number of X and Y points are not equal.<br>
 					Number of X-points:".count($this->coords[1])."<br>
 					Number of Y-points:$numpoints");
 	    else
diff --git a/src/jpgraph_pie.php b/src/jpgraph_pie.php
index 348c784..5e3cc5f 100644
--- a/src/jpgraph_pie.php
+++ b/src/jpgraph_pie.php
@@ -102,7 +102,7 @@ class PiePlot {
 	if( in_array($t,array_keys($this->themearr)) )
 	    $this->theme = $t;
 	else
-	    JpGraphError::Raise("JpGraph Error: Unknown theme: $t");
+	    (new JpGraphError())->Raise("JpGraph Error: Unknown theme: $t");
     }
 	
     function ExplodeSlice($e) {
@@ -141,7 +141,7 @@ class PiePlot {
 	if( ($size>0 && $size<=0.5) || ($size>10 && $size<1000) )
 	    $this->radius = $size;
 	else
-	    JpGraphError::Raise("JpGraph Error: Size (radius) for pie must either be specified as a fraction
+	    (new JpGraphError())->Raise("JpGraph Error: Size (radius) for pie must either be specified as a fraction
                                 [0, 0.5] of the size of the image or as an absolute size in pixels 
                                 in the range [10, 1000]");
     }
@@ -170,7 +170,7 @@ class PiePlot {
     // Should we display actual value or percentage?
     function SetLabelType($t) {
 	if( $t<0 || $t>1 ) 
-	    JpGraphError::Raise("JpGraph Error: Label type for pie plots must be 0 or 1 (not $t).");
+	    (new JpGraphError())->Raise("JpGraph Error: Label type for pie plots must be 0 or 1 (not $t).");
 	$this->labeltype=$t;
 	// Don't show percentage value when displaying absolute values
 	if( $t==1 )
@@ -224,7 +224,7 @@ class PiePlot {
     // nowadays since the introduction of SetLabelFormat()
     function SetPrecision($p,$psign=true) {
 	if( $p<0 || $p>8 ) 
-	    JpGraphError::Raise("JpGraph Error: Pie label Precision must be between 0 and 8");
+	    (new JpGraphError())->Raise("JpGraph Error: Pie label Precision must be between 0 and 8");
 	$this->labelformat="%01.".$p."f";
 	$this->show_psign=$psign;
     }
diff --git a/src/jpgraph_pie3d.php b/src/jpgraph_pie3d.php
index b4f5ac4..e74d077 100644
--- a/src/jpgraph_pie3d.php
+++ b/src/jpgraph_pie3d.php
@@ -35,7 +35,7 @@ class PiePlot3D extends PiePlot {
     // Must be between 20 and 70 degrees
     function SetAngle($a) {
 	if( $a<30 || $a>70 )
-	    JpGraphError::Raise("JpGraph: 3D Pie projection angle must be between 30 and 70 degrees.");
+	    (new JpGraphError())->Raise("JpGraph: 3D Pie projection angle must be between 30 and 70 degrees.");
 	else
 	    $this->angle = $a;
     }
@@ -88,7 +88,7 @@ class PiePlot3D extends PiePlot {
 
 	
     function ExplodeSlice($e) {
-	//JpGraphError::Raise("JpGraph Error: Exploding slices are not (yet) implemented for 3d pies graphs.");
+	//(new JpGraphError())->Raise("JpGraph Error: Exploding slices are not (yet) implemented for 3d pies graphs.");
 	//$this->explode_slice=$e;
     }
 	
diff --git a/src/jpgraph_scatter.php b/src/jpgraph_scatter.php
index 12b26c7..4a93413 100644
--- a/src/jpgraph_scatter.php
+++ b/src/jpgraph_scatter.php
@@ -22,7 +22,7 @@ class ScatterPlot extends Plot {
 // CONSTRUCTOR
     function ScatterPlot(&$datay,$datax=false) {
 	if( (count($datax) != count($datay)) && is_array($datax))
-	    JpGraphError::Raise("JpGraph: Scatterplot must have equal number of X and Y points.");
+	    (new JpGraphError())->Raise("JpGraph: Scatterplot must have equal number of X and Y points.");
 	$this->Plot($datay,$datax);
 	$this->mark = new PlotMark();
 	$this->mark->SetType(MARK_CIRCLE);
diff --git a/src/jpgraph_spider.php b/src/jpgraph_spider.php
index 4b93b8f..72ab8d3 100644
--- a/src/jpgraph_spider.php
+++ b/src/jpgraph_spider.php
@@ -344,7 +344,7 @@ class SpiderPlot {
     }
 	
     function GetCSIMareas() {
-	JpGraphError::Raise("JpGraph Error: Client side image maps not supported for SpiderPlots.");
+	(new JpGraphError())->Raise("JpGraph Error: Client side image maps not supported for SpiderPlots.");
     }
 	
     function Stroke(&$img, $pos, &$scale, $startangle) {
@@ -423,7 +423,7 @@ class SpiderGraph extends Graph {
 	
     function SetScale($axtype,$ymin=1,$ymax=1) {
 	if( $axtype != "lin" && $axtype != "log" ) {
-	    JpGraphError::Raise("Illegal scale for spiderplot ($axtype). Must be \"lin\" or \"log\"");
+	    (new JpGraphError())->Raise("Illegal scale for spiderplot ($axtype). Must be \"lin\" or \"log\"");
 	}
 	if( $axtype=="lin" ) {
 	    $this->yscale = new LinearScale(1,1);
@@ -433,7 +433,7 @@ class SpiderGraph extends Graph {
 	elseif( $axtype=="log" ) {
 	    $this->yscale = new LogScale(1,1);
 	    $this->yscale->ticks = new SpiderLogTicks();
-	    //JpGraphError::Raise("JpGraph Error: Logarithmic spider plots are not yet supported");
+	    //(new JpGraphError())->Raise("JpGraph Error: Logarithmic spider plots are not yet supported");
 	}
 		
 	$this->axis = new SpiderAxis($this->img,$this->yscale);
@@ -442,7 +442,7 @@ class SpiderGraph extends Graph {
 
     function SetPlotSize($s) {
 	if( $s<0.1 || $s>1 )
-	    JpGraphError::Raise("JpGraph Error: Spider Plot size must be between 0.1 and 1. (Your value=$s)");
+	    (new JpGraphError())->Raise("JpGraph Error: Spider Plot size must be between 0.1 and 1. (Your value=$s)");
 	$this->len=min($this->img->width,$this->img->height)*$s/2;
     }
 
@@ -462,7 +462,7 @@ class SpiderGraph extends Graph {
 		$this->ytick_factor=70;			
 	    break;		
 	    default:
-		JpGraphError::Raise("Unsupported Tick density: $densy");
+		(new JpGraphError())->Raise("Unsupported Tick density: $densy");
 	}
     }
 
@@ -492,7 +492,7 @@ class SpiderGraph extends Graph {
 	    $min=min($min,$p->Min());
 	}
 	if( $min < 0 ) 
-	    JpGraphError::Raise("JpGraph Error: Minimum data $min (Spider plots only makes sence to use when all data points > 0)");
+	    (new JpGraphError())->Raise("JpGraph Error: Minimum data $min (Spider plots only makes sence to use when all data points > 0)");
 	return array($min,$max);
     }	
 
@@ -516,10 +516,10 @@ class SpiderGraph extends Graph {
 		$this->axis_title[$i] = $i+1;
 	}
 	elseif(count($this->axis_title)<$nbrpnts) 
-	    JpGraphError::Raise("JpGraph: Number of titles does not match number of points in plot.");
+	    (new JpGraphError())->Raise("JpGraph: Number of titles does not match number of points in plot.");
 	for($i=0; $i<count($this->plots); ++$i )
 	    if( $nbrpnts != $this->plots[$i]->GetCount() )
-		JpGraphError::Raise("JpGraph: Each spider plot must have the same number of data points.");
+		(new JpGraphError())->Raise("JpGraph: Each spider plot must have the same number of data points.");
 
 	$this->StrokeFrame();
 	$astep=2*M_PI/$nbrpnts;
