-
-
Notifications
You must be signed in to change notification settings - Fork 6
Handle null-values of XML attributes #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.x
Are you sure you want to change the base?
Conversation
|
Wouldn’t it be better to fallback to the |
|
Having some attributes without a namespace is actually valid, but deprecated, see https://www.w3.org/TR/REC-rdf-syntax/#eventterm-attribute-URI so we should properly support that. |
| if ($attr->namespaceURI && $attr->localName) { | ||
| $metadata[] = $this->parseValue($attr->namespaceURI, $attr->localName, $attr->value); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if ($attr->namespaceURI && $attr->localName) { | |
| $metadata[] = $this->parseValue($attr->namespaceURI, $attr->localName, $attr->value); | |
| } | |
| $metadata[] = $this->parseValue($attr->namespaceURI ?? $desc->namespaceURI, $attr->localName, $attr->value); |
| $metadata[] = $this->parseValue($node->namespaceURI, $node->localName, $node); | ||
| if ($node->namespaceURI && $node->localName) { | ||
| $metadata[] = $this->parseValue($node->namespaceURI, $node->localName, $node); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be reverted as nodes without namespaces are not supported.
|
While testing with your image I noticed that a broken XMP metadata results in the image having no metadata at all. We should probably fix that so the valid metadata parts are still shown correctly. |
I tried parsing an image that resulted in an exception message
Contao\Image\Metadata\XmpFormat::parseValue(): Argument #1 ($namespace) must be of type string, null given, because the value for$attr->namespaceURIwas null. Not sure how that can happen, and no idea how to write a test for that, but I think the library should rather ignore these values than throw an exception?