darylldoyle / svg-sanitizer

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

Standalone scanning of files via CLI throwns Uncaught Error: Class with XPath #43

Closed 30129071 closed 3 years ago

30129071 commented 4 years ago

`php ../svg-sanitizer/src/svg-scanner.php "../myTestSVG.svg"

Fatal error: Uncaught Error: Class 'enshrined\svgSanitize\data\XPath' not found in C:\svg-sanitizer\src\Sanitizer.php:214 Stack trace:

0 C:\svg-sanitizer\src\svg-scanner.php(126): enshrined\svgSanitize\Sanitizer->sanitize('<?xml version="...')

1 {main}

thrown in C:\svg-sanitizer\src\Sanitizer.php on line 214`

I've used different versions from version 11 to 13.3 and they all produce this error, I have also tried reinstall the package via composer but still receive the same error.

ohader commented 3 years ago

Standalone scanner does not rely on Composer autoload. That's why new .../data/XPath.php needs to be added to the require section as well, see https://github.com/darylldoyle/svg-sanitizer/blob/master/src/svg-scanner.php#L11-L15