You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DOMElement::setAttribute() reaches EMPTY_SWITCH_DEFAULT_CASE() with DTD #FIXED default attributes #22825
Calling DOMElement::setAttribute() with an attribute name that resolves to a DTD #FIXED default attribute reaches an EMPTY_SWITCH_DEFAULT_CASE() in ext/dom/element.c.
But I expected this output instead: no crash, a new attribute is created on the element (as happens on 8.1-8.3).
On the legacy (non-spec-compliant) path, dom_get_attribute_or_nsdecl() -> xmlHasNsProp() falls back to the DTD and returns an xmlAttribute node (XML_ATTRIBUTE_DECL, type 16). The switch (attr->type) in setAttribute() only handles XML_ATTRIBUTE_NODE and XML_NAMESPACE_DECL, so a type-16 node hits the EMPTY_SWITCH_DEFAULT_CASE() branch.
This was introduced in 14b6c98. Before that, the default branch was a plain default: break;, which is why 8.1-8.3 are unaffected.
Activity
Merge branch 'PHP-8.5'
Fix phpGH-22825: DOM attribute methods on a DTD default attribute
Merge branch 'PHP-8.4' into PHP-8.5