10000 bug #36907 Fixes sprintf(): Too few arguments in form transformer (pe… · symfony/symfony@e8beef4 · GitHub
[go: up one dir, main page]

Skip to content

Commit e8beef4

Browse files
bug #36907 Fixes sprintf(): Too few arguments in form transformer (pedrocasado)
This PR was merged into the 3.4 branch. Discussion ---------- Fixes sprintf(): Too few arguments in form transformer Similar to: #29482 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | none | License | MIT | Doc PR | none Fixes the form reverse transformation when the method viewToNorm is called within a value with the character %: Before : "sprintf(): Too few arguments" After : Form reverse transformation works. Reference : http://php.net/manual/function.sprintf.php Commits ------- ff7d3f4 Fixes sprintf(): Too few arguments in form transformer
2 parents a3c460f + ff7d3f4 commit e8beef4

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9999
}
100100

101101
if (!$socket = stream_socket_server($host, $errno, $errstr)) {
102-
throw new RuntimeException(sprintf('Server start failed on "%s": '.$errstr.' '.$errno, $host));
102+
throw new RuntimeException(sprintf('Server start failed on "%s": ', $host).$errstr.' '.$errno);
103103
}
104104

105105
foreach ($this->getLogs($socket) as $clientId => $message) {

src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private function getManifestPath($path)
5959

6060
$this->manifestData = json_decode(file_get_contents($this->manifestPath), true);
6161
if (0 < json_last_error()) {
62-
throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest file "%s": '.json_last_error_msg(), $this->manifestPath));
62+
throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest file "%s": ', $this->manifestPath).json_last_error_msg());
6363
}
6464
}
6565

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function mkdir($dirs, $mode = 0777)
101101
if (!is_dir($dir)) {
102102
// The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one
103103
if (self::$lastError) {
104-
throw new IOException(sprintf('Failed to create "%s": '.self::$lastError, $dir), 0, null, $dir);
104+
throw new IOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
105105
}
106106
throw new IOException(sprintf('Failed to create "%s".', $dir), 0, null, $dir);
107107
}
@@ -171,16 +171,16 @@ public function remove($files)
171171
if (is_link($file)) {
172172
// See https://bugs.php.net/52176
173173
if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
174-
throw new IOException(sprintf('Failed to remove symlink "%s": '.self::$lastError, $file));
174+
throw new IOException(sprintf('Failed to remove symlink "%s": ', $file).self::$lastError);
175175
}
176176
} elseif (is_dir($file)) {
177177
$this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
178178

179179
if (!self::box('rmdir', $file) && file_exists($file)) {
180-
throw new IOException(sprintf('Failed to remove directory "%s": '.self::$lastError, $file));
180+
throw new IOException(sprintf('Failed to remove directory "%s": ', $file).self::$lastError);
181181
}
182182
} elseif (!self::box('unlink', $file) && file_exists($file)) {
183-
throw new IOException(sprintf('Failed to remove file "%s": '.self::$lastError, $file));
183+
throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
184184
}
185185
}
186186
}

src/Symfony/Component/Form/Form.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ private function modelToNorm($value)
10311031
$value = $transformer->transform($value);
10321032
}
10331033
} catch (TransformationFailedException $exception) {
1034-
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception);
1034+
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception);
10351035
}
10361036

10371037
return $value;
@@ -1055,7 +1055,7 @@ private function normToModel($value)
10551055
$value = $transformers[$i]->reverseTransform($value);
10561056
}
10571057
} catch (TransformationFailedException $exception) {
1058-
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception);
1058+
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception);
10591059
}
10601060

10611061
return $value;
@@ -1086,7 +1086,7 @@ private function normToView($value)
10861086
$value = $transformer->transform($value);
10871087
}
10881088
} catch (TransformationFailedException $exception) {
1089-
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception);
1089+
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception);
10901090
}
10911091

10921092
return $value;
@@ -1112,7 +1112,7 @@ private function viewToNorm($value)
11121112
$value = $transformers[$i]->reverseTransform($value);
11131113
}
11141114
} catch (TransformationFailedException $exception) {
1115-
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception);
1115+
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception);
11161116
}
11171117

11181118
return $value;

0 commit comments

Comments
 (0)
0