darylldoyle / svg-sanitizer

A PHP SVG/XML Sanitizer
GNU General Public License v2.0
456 stars 68 forks source link

Empty hrefs filling up the log #39

Closed mwittstrom closed 3 years ago

mwittstrom commented 4 years ago

There are alot of erroneous "Suspicious attribute 'href'" in the log ( $xmlIssues ) This makes it difficult to use the function getXmlIssues() the check if an svg string was correct.

This is caused by $element->getAttribute('href') returning an empty string for elements that doesn't have a href attribute, in combination with the function isHrefSafeValue saying that empty href aren't safe.

Adding an empty check to the function isHrefSafeValue solves this problem.

//Allow empty URI. if (empty($value)){ return true; }

abarkine commented 4 years ago

Created #42