fix: support Twig date filter for ServerSignatureDate in JSign#7644
Merged
vitormattos merged 2 commits intomainfrom May 6, 2026
Merged
fix: support Twig date filter for ServerSignatureDate in JSign#7644vitormattos merged 2 commits intomainfrom
vitormattos merged 2 commits intomainfrom
Conversation
Keep ${timestamp} for plain {{ServerSignatureDate}} templates so JSign can inject its signing timestamp, but provide an ISO date when the template transforms the value (for example with Twig date filters).
Add regression coverage for Twig date filter with timezone and keep compatibility assertion for the plain placeholder case.
Fixes #7619
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
PhpNativeHandler was setting ServerSignatureDate to a custom
'Y.m.d H:i:s UTC' string while JSignPdfHandler (after the prior
fix) and the preview context (SignatureTextService::parse) both
use DateTimeInterface::ATOM. This inconsistency could cause the
Twig |date() filter to fail or produce unexpected results in
PhpNativeHandler-signed documents.
Changes:
- PhpNativeHandler: use DateTimeImmutable::ATOM for ServerSignatureDate
- SignatureTextService::getAvailableVariables(): correct the
description to state the variable CAN be formatted with Twig
- JSignPdfHandlerTest: add cases for {{ ServerSignatureDate }}
with spaces, |date() without timezone, and GRAPHIC_ONLY +
date filter
- PhpNativeHandlerTest: assert ServerSignatureDate is valid
ISO 8601 / ATOM when passed to signatureTextService->parse()
Closes #7619
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Member
Author
|
/backport to stable33 |
Member
Author
|
/backport to stable32 |
This was referenced May 6, 2026
vitormattos
added a commit
that referenced
this pull request
May 6, 2026
Add PhpNativeHandler and PhpNativeHandlerTest from upstream PR #7644 to keep backport parity for ServerSignatureDate ATOM formatting coverage. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
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.
Summary
Fixes signing failures when
ServerSignatureDateis transformed in Twig templates (for example|date("d/m/Y H:i:s T", "Europe/Paris")) while preserving the existing${timestamp}behavior for plain templates.What changed
JSignPdfHandler::parseSignatureText()now chooses the source ofServerSignatureDatebased on template usage:${timestamp}when template uses plain{{ServerSignatureDate}}datefilter with timezone.{{ServerSignatureDate}}still renders to JSign placeholder (${timestamp}).Why
Issue #7619 reproduces only during signing because JSign path previously fed
${timestamp}into Twig parsing. This works for plain interpolation but breaks when Twig tries to format it as a date.Validation
composer test:unit -- --filter "JSignPdfHandlerTest::testGetSignatureText"composer test:unit -- --filter "JSignPdfHandlerTest::testGetSignatureTextWithTwigDateFilterAndTimezone"Ref #7619