Commit 302ad112 authored by Sascha Grossenbacher's avatar Sascha Grossenbacher Committed by Sascha Grossenbacher
Browse files

Issue #3277649 by Primsi, Berdir, maxilein: Deprecation notice for htmlspecialchars with php 8.1

parent a2c1f65f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ class SystemMemorySensorPlugin extends SensorPluginBase implements ExtendedInfoS
    $meminfo = [];
    foreach ($data as $line) {
      list($key, $val) = array_pad(explode(':', $line, 2), 2, NULL);
      if (empty($val)) {
        continue;
      }
      $meminfo[$key] = explode(' ', trim($val))[0];
    }

@@ -160,6 +163,9 @@ class SystemMemorySensorPlugin extends SensorPluginBase implements ExtendedInfoS
    $rows = [];
    foreach ($data as $line) {
      list($key, $val) = array_pad(explode(':', $line, 2), 2, NULL);
      if (empty($val)) {
        continue;
      }
      if (trim($key)) {
        $rows[] = [
          'type' => $key,
+3 −3
Original line number Diff line number Diff line
@@ -62,9 +62,9 @@ class WatchdogAggregatorSensorPlugin extends DatabaseAggregatorSensorPlugin impl
    parent::verboseResultHistory($output);
    // Add cutoff info message.
    if (isset($output['verbose_sensor_history']['#description'])) {
      $output['verbose_sensor_history']['#description'] = t('Records in dblog limited to :limit records. :parent_info', [
        ':limit' => \Drupal::configFactory()->get('dblog.settings')->get('row_limit'),
        ':parent_info' => $output['verbose_sensor_history']['#description'],
      $output['verbose_sensor_history']['#description'] = t('Records in dblog limited to @limit records. @parent_info', [
        '@limit' => \Drupal::configFactory()->get('dblog.settings')->get('row_limit'),
        '@parent_info' => $output['verbose_sensor_history']['#description'],
      ]);
    }
  }
+2 −1
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ class SensorResult implements SensorResultInterface {
      $msg_expected = $this->getExpectedValue() ? 'TRUE' : 'FALSE';
    }
    else {
      $msg_expected = $this->getExpectedValue();
      $msg_expected = $this->getExpectedValue() ?? '';
    }

    if (!empty($this->sensorMessage)) {
@@ -317,6 +317,7 @@ class SensorResult implements SensorResultInterface {
   * @throws \Drupal\monitoring\Sensor\SensorCompilationException
   */
  public function getFormattedValue($value) {
    $value = is_null($value) ? '' : $value;

    $value_type = $this->getSensorConfig()->getValueType();
    // If the value type is defined we have the formatter that will format the
+8 −18
Original line number Diff line number Diff line
@@ -71,9 +71,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {

    // Test creation of Node entity aggregator sensor.
    $page->fillField('Label', 'Node Entity Aggregator sensor');
    // Give the page time to load the machine name suggestion.
    sleep(1);
    $assert_session->pageTextContains('Machine name: node_entity_aggregator_sensor');
    $this->assertTrue($assert_session->waitForText('Machine name: node_entity_aggregator_sensor'));

    $page->selectFieldOption('Sensor Plugin', 'entity_aggregator');
    $assert_session->assertWaitOnAjaxRequest();
@@ -118,6 +116,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
    $assert_session->responseContains('<th>sticky</th>');

    // Assert that the output is correct.
    $this->assertSession()->elementExists('css', '#result')->click();
    $assert_session->linkExists($node->getTitle());
    $assert_session->linkExists($node->getOwner()->getDisplayName());
    $this->assertFalse($node->isSticky());
@@ -155,9 +154,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
    // Test creation of File entity aggregator sensor.
    $this->drupalGet('admin/config/system/monitoring/sensors/add');
    $page->fillField('Label', 'File Entity Aggregator sensor');
    // Give the page time to load the machine name suggestion.
    sleep(1);
    $assert_session->pageTextContains('Machine name: file_entity_aggregator_sensor');
    $this->assertTrue($assert_session->waitForText('Machine name: file_entity_aggregator_sensor'));

    $page->selectFieldOption('Sensor Plugin', 'entity_aggregator');
    $assert_session->assertWaitOnAjaxRequest();
@@ -201,6 +198,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
    $assert_session->responseContains('<th>created</th>');

    // Assert that the output is correct.
    $this->assertSession()->elementExists('css', '#result')->click();
    $assert_session->pageTextContains($file->getFilename());
    $assert_session->pageTextContains($file->uuid());
    $assert_session->pageTextContains($file->getSize());
@@ -222,9 +220,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
    // Configuration sensor.
    $this->drupalGet('admin/config/system/monitoring/sensors/add');
    $page->fillField('Label', 'UI created Sensor config');
    // Give the page time to load the machine name suggestion.
    sleep(1);
    $assert_session->pageTextContains('Machine name: ui_created_sensor_config');
    $this->assertTrue($assert_session->waitForText('Machine name: ui_created_sensor_config'));

    $page->selectFieldOption('Sensor Plugin', 'config_value');
    $assert_session->assertWaitOnAjaxRequest();
@@ -291,9 +287,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
    // Test the creation of a Watchdog sensor with default configuration.
    $this->drupalGet('admin/config/system/monitoring/sensors/add');
    $page->fillField('Label', 'Watchdog sensor');
    // Give the page time to load the machine name suggestion.
    sleep(1);
    $assert_session->pageTextContains('Machine name: watchdog_sensor');
    $this->assertTrue($assert_session->waitForText('Machine name: watchdog_sensor'));

    $page->selectFieldOption('Sensor Plugin', 'watchdog_aggregator');
    $assert_session->assertWaitOnAjaxRequest();
@@ -319,9 +313,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
    // Test that the entity id is set after selecting a watchdog sensor.
    $this->drupalGet('admin/config/system/monitoring/sensors/add');
    $page->fillField('Label', 'Test entity id');
    // Give the page time to load the machine name suggestion.
    sleep(1);
    $assert_session->pageTextContains('Machine name: test_entity_id');
    $this->assertTrue($assert_session->waitForText('Machine name: test_entity_id'));

    $page->selectFieldOption('Sensor Plugin', 'watchdog_aggregator');
    $assert_session->assertWaitOnAjaxRequest();
@@ -334,9 +326,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
    // Test that the description of the verbose output changes.
    $this->drupalGet('admin/config/system/monitoring/sensors/add');
    $page->fillField('Label', 'Test entity id');
    // Give the page time to load the machine name suggestion.
    sleep(1);
    $assert_session->pageTextContains('Machine name: test_entity_id');
    $this->assertTrue($assert_session->waitForText('Machine name: test_entity_id'));

    $page->selectFieldOption('Sensor Plugin', 'entity_aggregator');
    $assert_session->assertWaitOnAjaxRequest();
+15 −3
Original line number Diff line number Diff line
@@ -36,6 +36,12 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {

    \Drupal::moduleHandler()->loadAllIncludes('install');
    monitoring_install();

    // Prevent deprecation notices in file.install. Workaround for
    // https://www.drupal.org/project/drupal/issues/3279289.
    $request_stack = $this->container->get('request_stack');
    $request = $request_stack->getCurrentRequest();
    $request->server->set('SERVER_SOFTWARE', 'foo/bar');
  }

  /**
@@ -283,7 +289,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
  public function testImageMissingStyleSensorPlugin() {
    $this->installSchema('file', ['file_usage']);
    $this->installEntitySchema('file');
    $this->installConfig(['system']);
    $this->installConfig(['system', 'dblog']);

    // Fake some image style derivative errors.
    $file = file_save_data($this->randomMachineName());
@@ -436,7 +442,10 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
    $this->installEntitySchema('node');
    \Drupal::service('router.builder')->rebuild();

    $type1 = NodeType::create(['type' => $this->randomMachineName()]);
    $type1 = NodeType::create([
      'type' => $this->randomMachineName(),
      'name' => $this->randomString(),
    ]);
    $type1->save();

    $sensor1 = SensorConfig::create(array(
@@ -459,7 +468,10 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
    ));
    $sensor1->save();

    $type2 = NodeType::create(['type' => $this->randomMachineName()]);
    $type2 = NodeType::create([
      'type' => $this->randomMachineName(),
      'name' => $this->randomString(),
    ]);
    $type2->save();

    $sensor2 = SensorConfig::create(array(
Loading