Skip to content
Snippets Groups Projects
Verified Commit 8caea2cf authored by Dave Long's avatar Dave Long
Browse files

Issue #3328694 by murilohp, rpayanm, jonathan1055, xjm, cilefen: Incorrect sprintf parameter usage

(cherry picked from commit 465482a5)
parent 3f1c18a1
No related branches found
No related tags found
6 merge requests!8506Draft: Issue #3456536 by ibrahim tameme,!5646Issue #3350972 by nod_: [random test failure]...,!5600Issue #3350972 by nod_: [random test failure]...,!5343Issue #3305066 by quietone, Rename RedirectLeadingSlashesSubscriber,!3603#ISSUE 3346218 Add a different message on edit comment,!3555Issue #2473873: Views entity operations lack cacheability support, resulting in incorrect dropbuttons
...@@ -88,7 +88,7 @@ public function __construct(FileSystemInterface $fileSystem, StreamWrapperManage ...@@ -88,7 +88,7 @@ public function __construct(FileSystemInterface $fileSystem, StreamWrapperManage
*/ */
public function writeData(string $data, string $destination, int $replace = FileSystemInterface::EXISTS_RENAME): FileInterface { public function writeData(string $data, string $destination, int $replace = FileSystemInterface::EXISTS_RENAME): FileInterface {
if (!$this->streamWrapperManager->isValidUri($destination)) { if (!$this->streamWrapperManager->isValidUri($destination)) {
throw new InvalidStreamWrapperException(sprintf('Invalid stream wrapper: %destination', ['%destination' => $destination])); throw new InvalidStreamWrapperException("Invalid stream wrapper: {$destination}");
} }
$uri = $this->fileSystem->saveData($data, $destination, $replace); $uri = $this->fileSystem->saveData($data, $destination, $replace);
return $this->createOrUpdate($uri, $destination, $replace === FileSystemInterface::EXISTS_RENAME); return $this->createOrUpdate($uri, $destination, $replace === FileSystemInterface::EXISTS_RENAME);
...@@ -132,7 +132,7 @@ protected function createOrUpdate(string $uri, string $destination, bool $rename ...@@ -132,7 +132,7 @@ protected function createOrUpdate(string $uri, string $destination, bool $rename
*/ */
public function copy(FileInterface $source, string $destination, int $replace = FileSystemInterface::EXISTS_RENAME): FileInterface { public function copy(FileInterface $source, string $destination, int $replace = FileSystemInterface::EXISTS_RENAME): FileInterface {
if (!$this->streamWrapperManager->isValidUri($destination)) { if (!$this->streamWrapperManager->isValidUri($destination)) {
throw new InvalidStreamWrapperException(sprintf('Invalid stream wrapper: %destination', ['%destination' => $destination])); throw new InvalidStreamWrapperException("Invalid stream wrapper: {$destination}");
} }
$uri = $this->fileSystem->copy($source->getFileUri(), $destination, $replace); $uri = $this->fileSystem->copy($source->getFileUri(), $destination, $replace);
...@@ -166,7 +166,7 @@ public function copy(FileInterface $source, string $destination, int $replace = ...@@ -166,7 +166,7 @@ public function copy(FileInterface $source, string $destination, int $replace =
*/ */
public function move(FileInterface $source, string $destination, int $replace = FileSystemInterface::EXISTS_RENAME): FileInterface { public function move(FileInterface $source, string $destination, int $replace = FileSystemInterface::EXISTS_RENAME): FileInterface {
if (!$this->streamWrapperManager->isValidUri($destination)) { if (!$this->streamWrapperManager->isValidUri($destination)) {
throw new InvalidStreamWrapperException(sprintf('Invalid stream wrapper: %destination', ['%destination' => $destination])); throw new InvalidStreamWrapperException("Invalid stream wrapper: {$destination}");
} }
$uri = $this->fileSystem->move($source->getFileUri(), $destination, $replace); $uri = $this->fileSystem->move($source->getFileUri(), $destination, $replace);
$delete_source = FALSE; $delete_source = FALSE;
......
...@@ -185,6 +185,7 @@ public function testExistingError() { ...@@ -185,6 +185,7 @@ public function testExistingError() {
*/ */
public function testInvalidStreamWrapper() { public function testInvalidStreamWrapper() {
$this->expectException(InvalidStreamWrapperException::class); $this->expectException(InvalidStreamWrapperException::class);
$this->expectExceptionMessage('Invalid stream wrapper: foo://');
$source = $this->createFile(); $source = $this->createFile();
$this->fileRepository->copy($source, 'foo://'); $this->fileRepository->copy($source, 'foo://');
} }
......
...@@ -170,6 +170,7 @@ public function testExistingError() { ...@@ -170,6 +170,7 @@ public function testExistingError() {
*/ */
public function testInvalidStreamWrapper() { public function testInvalidStreamWrapper() {
$this->expectException(InvalidStreamWrapperException::class); $this->expectException(InvalidStreamWrapperException::class);
$this->expectExceptionMessage('Invalid stream wrapper: foo://');
$this->fileRepository->writeData('asdf', 'foo://'); $this->fileRepository->writeData('asdf', 'foo://');
} }
......
...@@ -209,6 +209,7 @@ public function testExistingError() { ...@@ -209,6 +209,7 @@ public function testExistingError() {
*/ */
public function testInvalidStreamWrapper() { public function testInvalidStreamWrapper() {
$this->expectException(InvalidStreamWrapperException::class); $this->expectException(InvalidStreamWrapperException::class);
$this->expectExceptionMessage('Invalid stream wrapper: foo://');
$source = $this->createFile(); $source = $this->createFile();
$this->fileRepository->move($source, 'foo://'); $this->fileRepository->move($source, 'foo://');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment