Commit ea6f8eb3 authored by Drew Webber's avatar Drew Webber
Browse files

Issue #3254699 by joelpittet, Liam Morland, joseph.olstad: [PHP 8.1] Passing...

Issue #3254699 by joelpittet, Liam Morland, joseph.olstad: [PHP 8.1] Passing null to parameter #1 check_plain()
parent 0768b797
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1905,7 +1905,7 @@ function format_string($string, array $args = array()) {
 * @ingroup sanitization
 */
function check_plain($text) {
  return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
  return htmlspecialchars((string) $text, ENT_QUOTES, 'UTF-8');
}

/**
+5 −0
Original line number Diff line number Diff line
@@ -480,6 +480,11 @@ class CommonXssUnitTest extends DrupalUnitTestCase {
   * Check that invalid multi-byte sequences are rejected.
   */
  function testInvalidMultiByte() {
     // Ignore PHP 8.0+ null deprecatations.
     $text = check_plain(NULL);
     $this->assertEqual($text, '', 'check_plain() casts null to string');
     $text = check_plain(FALSE);
     $this->assertEqual($text, '', 'check_plain() casts boolean to string');
     // Ignore PHP 5.3+ invalid multibyte sequence warning.
     $text = @check_plain("Foo\xC0barbaz");
     $this->assertEqual($text, '', 'check_plain() rejects invalid sequence "Foo\xC0barbaz"');