Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 5fd3ab9

Browse files
committed
Merge branch 'hotfix/46' into develop
Forward port #46 Conflicts: CHANGELOG.md
2 parents cac09b5 + 8e9035f commit 5fd3ab9

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Versions 0.3.0 and prior were released as "weierophinney/problem-details".
2626

2727
- Nothing.
2828

29-
## 1.0.2 - TBD
29+
## 1.0.2 - 2019-01-09
3030

3131
### Added
3232

@@ -46,7 +46,8 @@ Versions 0.3.0 and prior were released as "weierophinney/problem-details".
4646

4747
### Fixed
4848

49-
- Nothing.
49+
- [#46](https://github.com/zendframework/zend-problem-details/pull/46) adds code to ensure newlines are stripped when creating key names for XML
50+
payloads.
5051

5152
## 1.0.1 - 2018-07-25
5253

src/ProblemDetailsResponseFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ private function cleanKeysForXml(array $input): array
318318
{
319319
$return = [];
320320
foreach ($input as $key => $value) {
321+
$key = str_replace("\n", '_', $key);
321322
$startCharacterPattern =
322323
'[A-Z]|_|[a-z]|[\xC0-\xD6]|[\xD8-\xF6]|[\xF8-\x{2FF}]|[\x{370}-\x{37D}]|[\x{37F}-\x{1FFF}]|'
323324
. '[\x{200C}-\x{200D}]|[\x{2070}-\x{218F}]|[\x{2C00}-\x{2FEF}]|[\x{3001}-\x{D7FF}]|[\x{F900}-\x{FDCF}]'

test/ProblemDetailsResponseFactoryTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,11 @@ public function testCreateResponseRemovesInvalidCharactersFromXmlKeys(string $he
150150

151151
$additional = [
152152
'foo' => [
153-
'A#-' => 'foo',
154-
'-A-' => 'foo',
155-
'#B-' => 'foo',
153+
'A#-' => 'foo',
154+
'-A-' => 'foo',
155+
'#B-' => 'foo',
156+
"C\n-" => 'foo',
157+
chr(10) . 'C-' => 'foo',
156158
],
157159
];
158160

@@ -161,6 +163,8 @@ public function testCreateResponseRemovesInvalidCharactersFromXmlKeys(string $he
161163
'A_-',
162164
'_A-',
163165
'_B-',
166+
'C_-',
167+
'_C-',
164168
];
165169
} else {
166170
$expectedKeyNames = array_keys($additional['foo']);

0 commit comments

Comments
 (0)