Repository navigation
Fix TypeError on null TransactionKey in multi-segment BTD download (v3.2.x regression from v3.0.1) - #247
Open
noppel wants to merge 1 commit into
Open
Fix TypeError on null TransactionKey in multi-segment BTD download (v3.2.x regression from v3.0.1)#247noppel wants to merge 1 commit into
noppel wants to merge 1 commit into
Conversation
noppel
force-pushed
the
fix/null-transaction-key-and-base64-limit
branch
from
October 11, 2026 21:03
e15d469 to
74b6ca8
Compare
…64 limits In EBICS downloads with multiple segments the Transfer-phase response does not carry a <TransactionKey> element - the key is only sent in the Initialization response and reused on the client side. v3.0.1 tolerated the null via native base64_decode(); v3.2.0 switched to Base64Encoder with strict 'string $data' type-hint, causing a TypeError on every multi-segment download. The second fix raises MAX_ENCODED_LENGTH / MAX_RAW_LENGTH to 512 MB / 384 MB respectively, so aggregated DAR responses (dozens of PDFs in one response) do not hit the ceiling until a true buffered variant exists.
noppel
force-pushed
the
fix/null-transaction-key-and-base64-limit
branch
from
October 11, 2026 21:36
74b6ca8 to
db41207
Compare
This branch has not been deployed
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.
Multi-segment BTD download fails with TypeError on
nullTransactionKey (v3.2.x regression from v3.0.1)Affected versions: v3.2.0, v3.2.1 (and HEAD of
3.x).Last known good: v3.0.1.
EBICS protocol: H005 (EBICS 3.0), service
BTD(alsoDAR).Summary
In EBICS downloads with multiple segments (
<NumSegments>≥ 2), the Transfer-phase response for segment #2 onwards does not contain a<TransactionKey>element — that key is only transmitted in the Initialization response and is reused by the client for all subsequent segments. This is EBICS-spec-compliant behaviour from the bank server.ResponseHandler::extractDownloadSegment()still callsretrieveH00XTransactionKey()on every segment response, and in v3.2.x hands the result (null) straight toBase64Encoder::decode(string $data): string— which throwsv3.0.1 handled this transparently because it used the native
base64_decode()(which acceptsnulland returns''). The switch to the stricterBase64Encoderservice in v3.2.0 regressed the Transfer-phase path.Reproduce
Any
executeDownloadOrderagainst a UBS Keyport host that returns ≥ 2 segments. Example with aBTD/DAR/documentsservice that has multiple PDFs pending:Impact
Observed behaviour at UBS (Schweiz):
<NumSegments>34</NumSegments>and the first<OrderData>segment.000000 / EBICS_OKresponse — but without<TransactionKey>.extractDownloadSegmentcrashes before any user data can be used.For callers who have swallowed the TypeError in a generic catch (as our daemon unfortunately did), this manifests as silent "no data" for weeks while the bank register fills up.
Related second issue (same root cause area)
Once the TypeError is fixed, large aggregated downloads next hit:
The hard limit
Base64Encoder::MAX_ENCODED_LENGTH = 10 MB(andMAX_RAW_LENGTH ≈ 7.5 MB) is new in v3.2.x. A single DAR response bundling ~30 PDFs easily exceeds that. TheUse buffered analoghint in the error message points to a buffered variant that doesn't appear to exist in the currentServices/Processor/tree (onlyBase64Encoder.phpis shipped). v3.0.1 had no such limit.Suggested fix
The empty-string fallback matches v3.0.1 behaviour exactly. For the Base64 size limit, either raise the constants to accommodate typical DAR-sized responses (≥ 64 MB), or document and ship the buffered variant that
Use buffered analogpromises.Environment
cweagans/composer-patches.Happy to send a PR if preferred.