Skip to content

xmlreader: getAttributeNo()/getAttributeNs() return null, not an empty string#5674

Closed
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:sync-src/xmlreader-getattribute-null
Closed

xmlreader: getAttributeNo()/getAttributeNs() return null, not an empty string#5674
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:sync-src/xmlreader-getattribute-null

Conversation

@lacatoire

Copy link
Copy Markdown
Member

Both descriptions said they return an empty string when the attribute is missing or the reader is not positioned on an element node. They actually return null.

Verified in php-src: the stubs declare ?string, and in ext/xmlreader/php_xmlreader.c retchar starts at NULL and return_value is only written via RETVAL_STRING when the attribute exists, so it stays null otherwise.

@lacatoire lacatoire closed this Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant