Tuesday, 26 September 2017

Syntax error in PHP after upgrading to 5.4

I am getting the following error ever since I upgraded from PHP 5.2x or 5.3x (not sure which) to 5.4x:



syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting T_VARIABLE



The following is the code that generates the error. Essentially I have a class to create SVG image with a static draw() method defined in a derived class and a static helper function drawPng() on the base class that converts the SVG to PNG using Imagick. The error is at the marked line.



static function drawPng($filename, $data, &$options=array()) {
ob_start();
static::draw($data, $options); // <-- Error occurs
$svg = ob_get_clean();

$im = new Imagick();
if(!$im) die('Imagick not installed');

$bg = (empty($options['background']) ? 'transparent' : $options['background']);
$im->setBackgroundColor(new ImagickPixel($bg));
$im->readImageBlob($svg);
$im->setImageFormat('png');
if($filename) $im->writeImage($filename);
else echo $im->getImageBlob();
}


The code as shown above has worked until the upgrade. Thanks for the assistance.

No comments:

Post a Comment

casting - Why wasn&#39;t Tobey Maguire in The Amazing Spider-Man? - Movies &amp; TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...