php-svg-framework-SVGF icon indicating copy to clipboard operation
php-svg-framework-SVGF copied to clipboard

Error in examples

Open anJka opened this issue 6 years ago • 7 comments

Hello running the examples I get error (PHP 7.3): php-svg-framework-SVGF/examples/BasicShapesExample.php

_Notice: Undefined variable: attribute_value in /opt/lampp/htdocs/dev/php-svg-framework-SVGF/src/css/CSSStyleDeclaration.php on line 168

Notice: Undefined variable: item in /opt/lampp/htdocs/dev/php-svg-framework-SVGF/src/svgf/SVGFElement.php on line 69

Fatal error: Uncaught Error: Using $this when not in object context in /opt/lampp/htdocs/dev/php-svg-framework-SVGF/src/svg/SVGElement.php:23 Stack trace: #0 [internal function]: b1t\svg\SVGSVGElement::setId('a4') #1 /opt/lampp/htdocs/dev/php-svg-framework-SVGF/src/svg/SVGObject.php(62): call_user_func(Array, 'a4') #2 /opt/lampp/htdocs/dev/php-svg-framework-SVGF/src/svgf/SVGFElement.php(72): b1t\svg\SVGObject->_set('id', 'a4') #3 /opt/lampp/htdocs/dev/php-svg-framework-SVGF/examples/BasicShapesExample.php(20): b1t\svgf\SVGFElement::svg(Object(DOMDocument), 'a4', Array) #4 {main} thrown in /opt/lampp/htdocs/dev/php-svg-framework-SVGF/src/svg/SVGElement.php on line 23

anJka avatar Mar 03 '19 18:03 anJka

Hello,

I cannot reproduce the error in PHP 7.0. Based on the error log, the problem seems to happen when the id of the SVG element is set, but as I said, it works ok for me. Are the other examples working for you?

xavier-atero avatar Mar 07 '19 09:03 xavier-atero

no in fact all examples throw error maybe I installed it wrong with composer?

anJka avatar Mar 12 '19 11:03 anJka

I got similar fatatFatal error: Uncaught Error: Using $this when not in object context in /opt/lampp/htdocs/php-svg/src/svg/SVGElement.php:23 Stack trace: #0 [internal function]: b1t\svg\SVGSVGElement::setId('a4') #1 /opt/lampp/htdocs/php-svg/src/svg/SVGObject.php(62): call_user_func(Array, 'a4') #2 /opt/lampp/htdocs/php-svg/src/svgf/SVGFElement.php(72): b1t\svg\SVGObject->__set('id', 'a4') #3 /opt/lampp/htdocs/php-svg/examples/BasicShapesExample.php(20): b1t\svgf\SVGFElement::svg(Object(DOMDocument), 'a4', Array) #4 {main} thrown in /opt/lampp/htdocs/php-svg/src/svg/SVGElement.php on line 23

bogart0324 avatar Dec 06 '20 14:12 bogart0324

Same here. I'm looking at the code trying to fix it..

marioschlipf avatar Dec 30 '20 18:12 marioschlipf

me too i got the same problem who can help me ?

momolafrooo avatar Jan 31 '21 11:01 momolafrooo

Ok the original problem is a NOTICE in statement in b1t\svgf\SVGFElement.pgo line 69

$variable = $item ?: NULL;

$item is undefined and $cariable is never use just comment it out.

PulfordN avatar Feb 04 '21 14:02 PulfordN

The later problem is a call of call_user_func in b1t\svg\SVGObject.php one in the setter and one in the getter.

wanting a quick fix I did the following setter call_user_func($call_to_user_func,$attribute_value); replaced with $this->$string_set_method_name = $attribute_value;

getter return call_user_func($call_to_user_func,$attribute_value); replaced with return $this->$string_get_method_name();

It works for trhe examples

PulfordN avatar Feb 04 '21 14:02 PulfordN