-
Notifications
You must be signed in to change notification settings - Fork 38
fix(response): avoid error if response is too long #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ final class DownloadSegment extends Segment | |
| { | ||
| private string $transactionId; | ||
| private ?string $transactionPhase; | ||
| private string $transactionKey; | ||
| private ?string $transactionKey; | ||
| private ?int $segmentNumber; | ||
| private ?int $numSegments; | ||
| private string $orderData; | ||
|
|
@@ -37,12 +37,12 @@ public function setTransactionPhase(?string $phase): void | |
| $this->transactionPhase = $phase; | ||
| } | ||
|
|
||
| public function getTransactionKey(): string | ||
| public function getTransactionKey(): ?string | ||
| { | ||
| return $this->transactionKey; | ||
| } | ||
|
|
||
| public function setTransactionKey(string $transactionKey): void | ||
| public function setTransactionKey(?string $transactionKey): void | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure that it should be possible have not transactionKey for DownloadSegment. |
||
| { | ||
| $this->transactionKey = $transactionKey; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,15 +12,15 @@ | |
| */ | ||
| abstract class Segment | ||
| { | ||
| private string $transactionKey; | ||
| private ?string $transactionKey; | ||
| private Response $response; | ||
|
|
||
| public function getTransactionKey(): string | ||
| public function getTransactionKey(): ?string | ||
| { | ||
| return $this->transactionKey; | ||
| } | ||
|
|
||
| public function setTransactionKey(string $transactionKey): void | ||
| public function setTransactionKey(?string $transactionKey): void | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should not happen |
||
| { | ||
| $this->transactionKey = $transactionKey; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,11 @@ protected function createResponse(string $contents): Response | |
| } | ||
|
|
||
| $response = new Response(); | ||
| $response->loadXML($contents); | ||
| $loaded = @$response->loadXML($contents); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. But I really do not like supression for functions. I think better try, catch or something like error handler. So see real message in line 53. |
||
|
|
||
| if (false === $loaded) { | ||
| throw new RuntimeException('Failed to parse EBICS XML response. Response may be truncated or malformed.'); | ||
| } | ||
|
|
||
| return $response; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transaction key for some requests is not present, but for these requests
extractInitializationSegment()should not be applied. This is more wrong usage exception here. I would say, thattransactionKeyEncodedis required in this place and can be thrown appropriate exception if no transactionKeyEncoded.