Skip to content

Commit b684dca

Browse files
Merge branch '3.4' into 4.3
* 3.4: [Config][ReflectionClassResource] Handle parameters with undefined constant as their default values fix dumping number-like string parameters [Console] Fix autocomplete multibyte input support [Config] don't break on virtual stack frames in ClassExistenceResource
2 parents 997da3e + 39bc6fd commit b684dca

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed

Dumper/XmlDumper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,11 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent
324324
if (\in_array($value, ['null', 'true', 'false'], true)) {
325325
$element->setAttribute('type', 'string');
326326
}
327+
328+
if (\is_string($value) && (is_numeric($value) || preg_match('/^0b[01]*$/', $value) || preg_match('/^0x[0-9a-f]++$/i', $value))) {
329+
$element->setAttribute('type', 'string');
330+
}
331+
327332
$text = $this->document->createTextNode(self::phpToXml($value));
328333
$element->appendChild($text);
329334
}

Tests/Fixtures/containers/container8.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
'values' => [true, false, null, 0, 1000.3, 'true', 'false', 'null'],
1212
'binary' => "\xf0\xf0\xf0\xf0",
1313
'binary-control-char' => "This is a Bell char \x07",
14+
'null string' => 'null',
15+
'string of digits' => '123',
16+
'string of digits prefixed with minus character' => '-123',
17+
'true string' => 'true',
18+
'false string' => 'false',
19+
'binary number string' => '0b0110',
20+
'numeric string' => '-1.2E2',
21+
'hexadecimal number string' => '0xFF',
22+
'float string' => '10100.1',
23+
'positive float string' => '+10100.1',
24+
'negative float string' => '-10100.1',
1425
]));
1526

1627
return $container;

Tests/Fixtures/php/services8.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,17 @@ protected function getDefaultParameters()
126126
],
127127
'binary' => 'ðððð',
128128
'binary-control-char' => 'This is a Bell char ',
129+
'null string' => 'null',
130+
'string of digits' => '123',
131+
'string of digits prefixed with minus character' => '-123',
132+
'true string' => 'true',
133+
'false string' => 'false',
134+
'binary number string' => '0b0110',
135+
'numeric string' => '-1.2E2',
136+
'hexadecimal number string' => '0xFF',
137+
'float string' => '10100.1',
138+
'positive float string' => '+10100.1',
139+
'negative float string' => '-10100.1',
129140
];
130141
}
131142
}

Tests/Fixtures/xml/services8.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
</parameter>
2121
<parameter key="binary" type="binary">8PDw8A==</parameter>
2222
<parameter key="binary-control-char" type="binary">VGhpcyBpcyBhIEJlbGwgY2hhciAH</parameter>
23+
<parameter key="null string" type="string">null</parameter>
24+
<parameter key="string of digits" type="string">123</parameter>
25+
<parameter key="string of digits prefixed with minus character" type="string">-123</parameter>
26+
<parameter key="true string" type="string">true</parameter>
27+
<parameter key="false string" type="string">false</parameter>
28+
<parameter key="binary number string" type="string">0b0110</parameter>
29+
<parameter key="numeric string" type="string">-1.2E2</parameter>
30+
<parameter key="hexadecimal number string" type="string">0xFF</parameter>
31+
<parameter key="float string" type="string">10100.1</parameter>
32+
<parameter key="positive float string" type="string">+10100.1</parameter>
33+
<parameter key="negative float string" type="string">-10100.1</parameter>
2334
</parameters>
2435
<services>
2536
<service id="service_container" class="Symfony\Component\DependencyInjection\ContainerInterface" public="true" synthetic="true"/>

Tests/Fixtures/yaml/services8.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ parameters:
66
values: [true, false, null, 0, 1000.3, 'true', 'false', 'null']
77
binary: !!binary 8PDw8A==
88
binary-control-char: !!binary VGhpcyBpcyBhIEJlbGwgY2hhciAH
9+
null string: 'null'
10+
string of digits: '123'
11+
string of digits prefixed with minus character: '-123'
12+
true string: 'true'
13+
false string: 'false'
14+
binary number string: '0b0110'
15+
numeric string: '-1.2E2'
16+
hexadecimal number string: '0xFF'
17+
float string: '10100.1'
18+
positive float string: '+10100.1'
19+
negative float string: '-10100.1'
920

1021
services:
1122
service_container:

0 commit comments

Comments
 (0)