Skip to content

Fix signature construction and the temporary file warning - #1

Merged
edeoliv merged 1 commit into
mainfrom
fix/signature-build
Sep 19, 2026
Merged

edeoliv merged 1 commit into
mainfrom
fix/signature-build

Conversation

@edeoliv

@edeoliv edeoliv commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

What

XadesSignature::build() used element() to set the Id on ds:SignatureValue. That helper reads $this->document, which the constructor assigns only after build() returns, so constructing any signature failed with "Typed property … must not be accessed before initialization". The element now gets its Id as it is created.

Container::save() removed a temporary file with @unlink even when it was not there, which surfaces as a warning under a strict test runner. It now checks first.

Test

composer test — 11 passed, 26 assertions.

XadesSignature::build() reached for SignatureValue through element(), which
reads $this->document — a property the constructor only assigns once build()
returns, so every signature threw on construction. The element is now created
and given its Id directly.

Container::save() called @Unlink on a temporary file that does not exist on a
first save; it checks for the file instead, so no warning is raised.
@edeoliv
edeoliv merged commit 2265151 into main Sep 19, 2026
@edeoliv
edeoliv deleted the fix/signature-build branch September 19, 2026 15:22
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