atgp / factur-x

PHP library to manage your Factur-X / ZUGFeRD 2.0 PDF invoices files
MIT License
87 stars 22 forks source link

Multiple warnings occur parsing incorrect XML data #29

Open madmajestro opened 9 months ago

madmajestro commented 9 months ago

When incorrect XML data is passed to the function validate() (atgp/factur-x/src/XsdValidator.php:47), multiple warnings occur:

atgp/factur-x/src/XsdValidator.php:53: "Warning: DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1".

atgp/factur-x/src/Utils/ProfileHandler.php:26: "Warning: DOMXPath::query(): Undefined namespace prefix" ()

atgp/factur-x/src/Utils/ProfileHandler.php:27: "Warning: Attempt to read property \"length\" on bool"

We are currently using PHP 8.2.

Unfortunately, for privacy reasons, I cannot attach an example file. I still hope that this information is enough to fix the problem and improve factur-x.

benito103e commented 9 months ago

@madmajestro : What are you expecting to be thrown in this case? Would an exception be preferable than warnings ?

Can you propose a PR for this?