Fix signature construction and the temporary file warning - #1
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
XadesSignature::build()usedelement()to set theIdonds:SignatureValue. That helper reads$this->document, which the constructor assigns only afterbuild()returns, so constructing any signature failed with "Typed property … must not be accessed before initialization". The element now gets itsIdas it is created.Container::save()removed a temporary file with@unlinkeven 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.