Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f65991

Browse files
Merge branch '3.4' into 4.4
* 3.4: [Process] Fix Permission Denied error when writing sf_proc_00 lock files on Windows fix handling null as empty data No need to create an issue when creating a PR [Console] Fixes question input encoding on Windows
2 parents 3b1e34b + c0181c7 commit 2f65991

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
| Bug fix? | yes/no
55
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
66
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
7-
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", if any -->
7+
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
88
| License | MIT
99
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
1010
<!--

src/Symfony/Component/Console/Helper/QuestionHelper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ private function doAsk(OutputInterface $output, Question $question)
108108
$inputStream = $this->inputStream ?: STDIN;
109109
$autocomplete = $question->getAutocompleterCallback();
110110

111+
if (\function_exists('sapi_windows_cp_set')) {
112+
// Codepage used by cmd.exe on Windows to allow special characters (éàüñ).
113+
sapi_windows_cp_set(1252);
114+
}
115+
111116
if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
112117
$ret = false;
113118
if ($question->isHidden()) {

src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ public function transform($value)
140140
*/
141141
public function reverseTransform($value)
142142
{
143-
if (!\is_string($value)) {
143+
if (null !== $value && !\is_string($value)) {
144144
throw new TransformationFailedException('Expected a string.');
145145
}
146146

147-
if ('' === $value) {
147+
if (null === $value || '' === $value) {
148148
return null;
149149
}
150150

src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,21 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = '10', $expectedD
130130
$this->assertSame($expectedData, $form->getData());
131131
}
132132

133+
public function testSubmitNullWithEmptyDataSetToNull()
134+
{
135+
$form = $this->factory->create(static::TESTED_TYPE, null, [
136+
'empty_data' => null,
137+
]);
138+
$form->submit(null);
139+
140+
$this->assertTrue($form->isSubmitted());
141+
$this->assertTrue($form->isSynchronized());
142+
$this->assertTrue($form->isValid());
143+
$this->assertSame('', $form->getViewData());
144+
$this->assertNull($form->getNormData());
145+
$this->assertNull($form->getData());
146+
}
147+
133148
public function testSubmitNumericInput(): void
134149
{
135150
$form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'number']);

src/Symfony/Component/Process/Pipes/WindowsPipes.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public function __construct($input, bool $haveReadSupport)
5656
$file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
5757

5858
if (!$h = fopen($file.'.lock', 'w')) {
59+
if (file_exists($file.'.lock')) {
60+
continue 2;
61+
}
5962
restore_error_handler();
6063
throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError);
6164
}

0 commit comments

Comments
 (0)