HuasoFoundries/jpgraph

Fatal errors in Image class getWidth and getHeight static methods

Closed this issue · 0 comments

If one would call \Amenadiel\JpGraph\Image\Image::GetWidth(null) or \Amenadiel\JpGraph\Image\Image::GetHeight(null) - you would get a fatal error in any PHP version: https://3v4l.org/Ao64k

php > require_once 'vendor/autoload.php';
php > \Amenadiel\JpGraph\Image\Image::getWidth(null);
Warning: Uncaught Error: Using $this when not in object context in /srv/marketing/vendor/amenadiel/jpgraph/src/image/Image.php:269
Stack trace:
#0 php shell code(1): Amenadiel\JpGraph\Image\Image::GetWidth()
#1 {main}
  thrown in /srv/marketing/vendor/amenadiel/jpgraph/src/image/Image.php on line 269


php > \Amenadiel\JpGraph\Image\Image::getHeight(null);
Warning: Uncaught Error: Using $this when not in object context in /srv/marketing/vendor/amenadiel/jpgraph/src/image/Image.php:278
Stack trace:
#0 php shell code(1): Amenadiel\JpGraph\Image\Image::GetHeight()
#1 {main}
  thrown in /srv/marketing/vendor/amenadiel/jpgraph/src/image/Image.php on line 278

I would suggest removing the possibility to call the function with a null parameter, since this never worked, since these methods were introduced.