Commit f680e8ea authored by catch's avatar catch
Browse files

Issue #3239295 by alexpott: Passing NULL to the $replace parameter of...

Issue #3239295 by alexpott: Passing NULL to the $replace parameter of str_replace() and preg_replace() triggers a deprecation in PHP 8.1
parent a9de1644
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
    // For comment entity types get the destination bundle from the
    // d7_comment_type migration, if it exists.
    if ($entity_type === 'comment' && $bundle != 'comment_forum') {
      $value = preg_replace('/comment_node_/', NULL, $bundle);
      $value = str_replace('comment_node_', '', $bundle);
      $migration = 'd7_comment_type';
      $lookup_result = $this->migrateLookup->lookup($migration, [$value]);
      $lookup_result = empty($lookup_result) ? NULL : reset($lookup_result[0]);
+1 −1
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ public function testImageDimensions() {
   * altered and the element is re-rendered each time.
   */
  protected function getImageTag($variables) {
    return str_replace("\n", NULL, \Drupal::service('renderer')->renderRoot($variables));
    return str_replace("\n", '', \Drupal::service('renderer')->renderRoot($variables));
  }

}
+5 −5
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ public function _testImageFieldFormatters($scheme) {
      '#height' => 20,
      '#alt' => $alt,
    ];
    $default_output = str_replace("\n", NULL, $renderer->renderRoot($image));
    $default_output = str_replace("\n", '', $renderer->renderRoot($image));
    $this->assertSession()->responseContains($default_output);

    // Test the image linked to file formatter.
@@ -305,7 +305,7 @@ public function testImageFieldSettings() {
    ];
    $this->drupalGet('node/' . $nid . '/edit');
    $this->submitForm($edit, 'Save');
    $default_output = str_replace("\n", NULL, $renderer->renderRoot($image));
    $default_output = str_replace("\n", '', $renderer->renderRoot($image));
    $this->assertSession()->responseContains($default_output);

    // Verify that alt/title longer than allowed results in a validation error.
@@ -398,7 +398,7 @@ public function testImageFieldDefaultImage() {
      '#width' => 40,
      '#height' => 20,
    ];
    $default_output = str_replace("\n", NULL, $renderer->renderRoot($image));
    $default_output = str_replace("\n", '', $renderer->renderRoot($image));
    $this->drupalGet('node/' . $node->id());
    $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]);
    // Verify that no image style cache tags are found.
@@ -423,7 +423,7 @@ public function testImageFieldDefaultImage() {
      '#height' => 20,
      '#alt' => $alt,
    ];
    $image_output = str_replace("\n", NULL, $renderer->renderRoot($image));
    $image_output = str_replace("\n", '', $renderer->renderRoot($image));
    $this->drupalGet('node/' . $nid);
    $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]);
    // Verify that no image style cache tags are found.
@@ -477,7 +477,7 @@ public function testImageFieldDefaultImage() {
      '#width' => 40,
      '#height' => 20,
    ];
    $default_output = str_replace("\n", NULL, $renderer->renderRoot($image));
    $default_output = str_replace("\n", '', $renderer->renderRoot($image));
    $this->drupalGet('node/' . $node->id());
    $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]);
    // Verify that no image style cache tags are found.
+1 −1
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles =
      '#height' => 240,
      '#alt' => $alt,
    ];
    $default_output = str_replace("\n", NULL, $renderer->renderRoot($image));
    $default_output = str_replace("\n", '', $renderer->renderRoot($image));
    $this->assertSession()->responseContains($default_output);

    // Test field not being configured. This should not cause a fatal error.