Commit 45839ad7 authored by Drew Webber's avatar Drew Webber
Browse files

Issue #3270881 by poker10, mfb: PHP 8.1 strpos(): Passing null to parameter #1...

Issue #3270881 by poker10, mfb: PHP 8.1 strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in text_summary()
parent 90547993
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -348,6 +348,11 @@ function _text_sanitize($instance, $langcode, $item, $column) {
 */
function text_summary($text, $format = NULL, $size = NULL) {

  // If the input text is NULL, return unchanged.
  if (is_null($text)) {
    return NULL;
  }

  if (!isset($size)) {
    // What used to be called 'teaser' is now called 'summary', but
    // the variable 'teaser_length' is preserved for backwards compatibility.
+8 −0
Original line number Diff line number Diff line
@@ -378,6 +378,14 @@ class TextSummaryTestCase extends DrupalWebTestCase {
    }
  }

  /**
   * Test for the NULL value.
   */
  function testNullSentence() {
    $summary = text_summary(NULL);
    $this->assertNull($summary, 'text_summary() casts returned null');
  }

  /**
   * Calls text_summary() and asserts that the expected teaser is returned.
   */