Commit c1596550 authored by alexpott's avatar alexpott

Issue #2568775 by dawehner, lauriii, alexpott, joelpittet, xjm: Replace...

Issue #2568775 by dawehner, lauriii, alexpott, joelpittet, xjm: Replace remaining !placeholder for Non-URL HTML outputs only for $e->getMessage()
parent c5d96cb8
......@@ -762,7 +762,7 @@ protected function processConfiguration($collection, $op, $name) {
}
}
catch (\Exception $e) {
$this->logError($this->t('Unexpected error during import with operation @op for @name: !message', array('@op' => $op, '@name' => $name, '!message' => $e->getMessage())));
$this->logError($this->t('Unexpected error during import with operation @op for @name: @message', array('@op' => $op, '@name' => $name, '@message' => $e->getMessage())));
// Error for that operation was logged, mark it as processed so that
// the import can continue.
$this->setProcessedConfiguration($collection, $op, $name);
......
......@@ -179,8 +179,8 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
catch (\Exception $e) {
// The format of this error message is similar to that used on the
// database connection form in the installer.
$form_state->setErrorByName('connection_settings', $this->t('Failed to connect to the server. The server reports the following message: !message For more help installing or updating code on your server, see the <a href="@handbook_url">handbook</a>.', array(
'!message' => '<p class="error">' . $e->getMessage() . '</p>',
$form_state->setErrorByName('connection_settings', $this->t('Failed to connect to the server. The server reports the following message: <p class="error">@message</p> For more help installing or updating code on your server, see the <a href="@handbook_url">handbook</a>.', array(
'@message' => $e->getMessage(),
'@handbook_url' => 'https://www.drupal.org/documentation/install/modules-themes',
)));
}
......
......@@ -257,7 +257,7 @@ public function update(&$filetransfer, $overrides = array()) {
return $this->postUpdateTasks();
}
catch (FileTransferException $e) {
throw new UpdaterFileTransferException(t('File Transfer failed, reason: !reason', array('!reason' => strtr($e->getMessage(), $e->arguments))));
throw new UpdaterFileTransferException(t('File Transfer failed, reason: @reason', array('@reason' => strtr($e->getMessage(), $e->arguments))));
}
}
......@@ -295,7 +295,7 @@ public function install(&$filetransfer, $overrides = array()) {
return $this->postInstallTasks();
}
catch (FileTransferException $e) {
throw new UpdaterFileTransferException(t('File Transfer failed, reason: !reason', array('!reason' => strtr($e->getMessage(), $e->arguments))));
throw new UpdaterFileTransferException(t('File Transfer failed, reason: @reason', array('@reason' => strtr($e->getMessage(), $e->arguments))));
}
}
......
......@@ -7,6 +7,7 @@
namespace Drupal\config\Tests;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Config\ConfigImporterException;
......@@ -295,7 +296,7 @@ function testSecondaryWriteSecondaryFirst() {
$logs = $this->configImporter->getErrors();
$this->assertEqual(count($logs), 1);
$this->assertEqual($logs[0], SafeMarkup::format("Unexpected error during import with operation @op for @name: 'config_test' entity with ID '@name_secondary' already exists.", array('@op' => 'create', '@name' => $name_primary, '@name_secondary' => 'secondary')));
$this->assertEqual($logs[0], Html::escape("Unexpected error during import with operation create for $name_primary: 'config_test' entity with ID 'secondary' already exists."));
}
/**
......
......@@ -222,7 +222,7 @@ public function import() {
}
catch (\Exception $e) {
$this->message->display(
$this->t('Migration failed with source plugin exception: !e', array('!e' => $e->getMessage())), 'error');
$this->t('Migration failed with source plugin exception: @e', array('@e' => $e->getMessage())), 'error');
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
return MigrationInterface::RESULT_FAILED;
}
......@@ -299,8 +299,8 @@ public function import() {
}
catch (\Exception $e) {
$this->message->display(
$this->t('Migration failed with source plugin exception: !e',
array('!e' => $e->getMessage())), 'error');
$this->t('Migration failed with source plugin exception: @e',
array('@e' => $e->getMessage())), 'error');
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
return MigrationInterface::RESULT_FAILED;
}
......
......@@ -7,6 +7,7 @@
namespace Drupal\Tests\migrate\Unit;
use Drupal\Component\Utility\Html;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\migrate\MigrateException;
......@@ -72,7 +73,7 @@ public function testImportWithFailingRewind() {
// Ensure that a message with the proper message was added.
$this->message->expects($this->once())
->method('display')
->with("Migration failed with source plugin exception: $exception_message");
->with("Migration failed with source plugin exception: " . Html::escape($exception_message));
$result = $this->executable->import();
$this->assertEquals(MigrationInterface::RESULT_FAILED, $result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment