Issue #2568775 by dawehner, lauriii, alexpott, joelpittet, xjm: Replace remaining !placeholder for Non-URL HTML outputs only for $e->getMessage()

8.0.x
Alex Pott 2015-09-20 18:50:16 +01:00
parent c5d96cb883
commit c159655015
6 changed files with 12 additions and 10 deletions

View File

@ -762,7 +762,7 @@ class ConfigImporter {
}
}
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);

View File

@ -179,8 +179,8 @@ class FileTransferAuthorizeForm extends FormBase {
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',
)));
}

View File

@ -257,7 +257,7 @@ class Updater {
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 @@ class Updater {
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))));
}
}

View File

@ -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 @@ class ConfigImporterTest extends KernelTestBase {
$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."));
}
/**

View File

@ -222,7 +222,7 @@ class MigrateExecutable implements MigrateExecutableInterface {
}
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 @@ class MigrateExecutable implements MigrateExecutableInterface {
}
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;
}

View File

@ -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 @@ class MigrateExecutableTest extends MigrateTestCase {
// 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);