Skip to content

fix(azure): Clear libxml errors after parsing error responses - #2725

Open
DerDreschner wants to merge 1 commit into
masterfrom
fix/azure-libxml-errors
Open

DerDreschner wants to merge 1 commit into
masterfrom
fix/azure-libxml-errors

Conversation

@DerDreschner

Copy link
Copy Markdown
Member

Summary

Patches microsoft/azure-storage-common so that ServiceException clears the libxml errors it causes and restores the previous libxml_use_internal_errors() setting.

With newer libxml2 (e.g. 2.15 on Ubuntu 26.04, Alpine 3.21+), the empty body of a 404 response to a HEAD or GET request leaves "Document is empty" in the libxml error buffer. sabre/xml reads that buffer after parsing. Every later parse in the same request or CLI process then throws a LibXMLException, e.g. for WebDAV storages and federated shares. It's also why the Azure object storage tests in server fail on the newer CI runners.

Example runs that fail:

The SDK is archived upstream, so it can only be fixed with a patch. Upstream report: Azure/azure-storage-common-php#9

AI

  • The content of this PR was partly or fully generated using AI

ServiceException::parseErrorMessage() enables libxml's internal errors,
but only restores the previous setting when the body parses, and never
clears the errors. Newer libxml2 versions (e.g. 2.15 on Ubuntu 26.04)
record "Document is empty" for the empty body of a 404 response to a
HEAD or GET request, so that error stays in the buffer.

sabre/xml reads the buffer after parsing, so every later parse in the
same request or CLI process failed with a LibXMLException, even for
valid XML such as the PROPFIND response of a WebDAV storage or a
federated share.

The upstream repository is archived, so the fix is applied as a patch.
Upstream report: Azure/azure-storage-common-php#9

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
@DerDreschner

Copy link
Copy Markdown
Member Author

/backport to stable35

@DerDreschner

Copy link
Copy Markdown
Member Author

/backport to stable34

@DerDreschner

Copy link
Copy Markdown
Member Author

/backport to stable33

@DerDreschner

Copy link
Copy Markdown
Member Author

/backport to stable32

@DerDreschner

Copy link
Copy Markdown
Member Author

/backport to stable31

@DerDreschner

DerDreschner commented Nov 18, 2026 •

Copy link
Copy Markdown
Member Author

Backport to stable32 down to stable29 is necessary to avoid broken CI runs there...

@DerDreschner

Copy link
Copy Markdown
Member Author

/backport to stable30

@DerDreschner

Copy link
Copy Markdown
Member Author

/backport to stable29

@susnux

susnux commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

(btw for master I plan to remove it: #2686 )

@DerDreschner

Copy link
Copy Markdown
Member Author

(btw for master I plan to remove it: #2686 )

Do you plan to backport it in any way? Or should I target stable35 downwards instead with this patch?

@susnux

susnux commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

No only master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants