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
-------
ff7d3f4f01
Fixes sprintf(): Too few arguments in form transformer
This commit is contained in:
commit
e8beef468b
@ -99,7 +99,7 @@ EOF
|
||||
}
|
||||
|
||||
if (!$socket = stream_socket_server($host, $errno, $errstr)) {
|
||||
throw new RuntimeException(sprintf('Server start failed on "%s": '.$errstr.' '.$errno, $host));
|
||||
throw new RuntimeException(sprintf('Server start failed on "%s": ', $host).$errstr.' '.$errno);
|
||||
}
|
||||
|
||||
foreach ($this->getLogs($socket) as $clientId => $message) {
|
||||
|
@ -59,7 +59,7 @@ class JsonManifestVersionStrategy implements VersionStrategyInterface
|
||||
|
||||
$this->manifestData = json_decode(file_get_contents($this->manifestPath), true);
|
||||
if (0 < json_last_error()) {
|
||||
throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest file "%s": '.json_last_error_msg(), $this->manifestPath));
|
||||
throw new \RuntimeException(sprintf('Error parsing JSON from asset manifest file "%s": ', $this->manifestPath).json_last_error_msg());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ class Filesystem
|
||||
if (!is_dir($dir)) {
|
||||
// The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one
|
||||
if (self::$lastError) {
|
||||
throw new IOException(sprintf('Failed to create "%s": '.self::$lastError, $dir), 0, null, $dir);
|
||||
throw new IOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
|
||||
}
|
||||
throw new IOException(sprintf('Failed to create "%s".', $dir), 0, null, $dir);
|
||||
}
|
||||
@ -171,16 +171,16 @@ class Filesystem
|
||||
if (is_link($file)) {
|
||||
// See https://bugs.php.net/52176
|
||||
if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
|
||||
throw new IOException(sprintf('Failed to remove symlink "%s": '.self::$lastError, $file));
|
||||
throw new IOException(sprintf('Failed to remove symlink "%s": ', $file).self::$lastError);
|
||||
}
|
||||
} elseif (is_dir($file)) {
|
||||
$this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
|
||||
|
||||
if (!self::box('rmdir', $file) && file_exists($file)) {
|
||||
throw new IOException(sprintf('Failed to remove directory "%s": '.self::$lastError, $file));
|
||||
throw new IOException(sprintf('Failed to remove directory "%s": ', $file).self::$lastError);
|
||||
}
|
||||
} elseif (!self::box('unlink', $file) && file_exists($file)) {
|
||||
throw new IOException(sprintf('Failed to remove file "%s": '.self::$lastError, $file));
|
||||
throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1031,7 +1031,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception);
|
||||
throw new TransformationFailedException(sprintf('Unable to transform data for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception);
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1055,7 +1055,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$value = $transformers[$i]->reverseTransform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception);
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception);
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1086,7 +1086,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$value = $transformer->transform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception);
|
||||
throw new TransformationFailedException(sprintf('Unable to transform value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception);
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -1112,7 +1112,7 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$value = $transformers[$i]->reverseTransform($value);
|
||||
}
|
||||
} catch (TransformationFailedException $exception) {
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": '.$exception->getMessage(), $this->getPropertyPath()), $exception->getCode(), $exception);
|
||||
throw new TransformationFailedException(sprintf('Unable to reverse value for property path "%s": ', $this->getPropertyPath()).$exception->getMessage(), $exception->getCode(), $exception);
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
Reference in New Issue
Block a user