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

Commit ce64d54

Browse files
committed
Merge branch 'hotfix/46'
Close #46 Fixes #45
2 parents b591f4e + 8e9035f commit ce64d54

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

.travis.yml

+9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ matrix:
3333
- php: 7.2
3434
env:
3535
- DEPS=latest
36+
- php: 7.3
37+
env:
38+
- DEPS=lowest
39+
- php: 7.3
40+
env:
41+
- DEPS=locked
42+
- php: 7.3
43+
env:
44+
- DEPS=latest
3645

3746
before_install:
3847
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi

CHANGELOG.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file, in reverse
44

55
Versions 0.3.0 and prior were released as "weierophinney/problem-details".
66

7-
## 1.0.2 - TBD
7+
## 1.0.2 - 2019-01-09
88

99
### Added
1010

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

2525
### Fixed
2626

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

2930
## 1.0.1 - 2018-07-25
3031

src/ProblemDetailsResponseFactory.php

+1
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

+7-3
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)