[GIT-PULLS] [php-src] PR #22830: Fix GH-22825: DOM attribute methods on a DTD default attribute

[email protected] (iliaal) Mon, 20 Jul 2026 13:31:17 +0000
Newsgroups php.git-pulls
Message-ID <[email protected]>
Pull Request: https://github.com/php/php-src/pull/22830
Author: iliaal

`xmlHasNsProp()` falls back to the internal subset, so on the legacy DOM an attribute lookup can return a DTD attribute declaration, and the switches over it never enumerated XML_ATTRIBUTE_DECL. EMPTY_SWITCH_DEFAULT_CASE compiles to `__builtin_unreachable()`, so instead of asserting, a release build silently returns false from setAttribute() and creates nothing. Any declaration carrying a default value hits this, not only #FIXED.

setAttribute() now creates the attribute as it did before 8.4. removeAttribute() returns false for a declaration, which is an observable change. The read-only callers are left for a separate report.

Fixes #22825