Loading includes/bootstrap.inc +1 −1 Original line number Diff line number Diff line Loading @@ -1933,7 +1933,7 @@ function check_plain($text) { * TRUE if the text is valid UTF-8, FALSE if not. */ function drupal_validate_utf8($text) { if (strlen($text) == 0) { if (strlen((string) $text) == 0) { return TRUE; } // With the PCRE_UTF8 modifier 'u', preg_match() fails silently on strings Loading includes/common.inc +1 −1 Original line number Diff line number Diff line Loading @@ -1500,7 +1500,7 @@ function filter_xss($string, $allowed_tags = array('a', 'em', 'strong', 'cite', // Store the text format. _filter_xss_split($allowed_tags, TRUE); // Remove NULL characters (ignored by some browsers). $string = str_replace(chr(0), '', $string); $string = str_replace(chr(0), '', (string) $string); // Remove Netscape 4 JS entities. $string = preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string); Loading modules/simpletest/tests/common.test +5 −1 Original line number Diff line number Diff line Loading @@ -480,11 +480,15 @@ class CommonXssUnitTest extends DrupalUnitTestCase { * Check that invalid multi-byte sequences are rejected. */ function testInvalidMultiByte() { // Ignore PHP 8.0+ null deprecatations. // Ignore PHP 8.0+ null deprecations. $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'); $text = filter_xss(NULL); $this->assertEqual($text, '', 'filter_xss() casts null to string'); $text = filter_xss(FALSE); $this->assertEqual($text, '', 'filter_xss() 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"'); Loading Loading
includes/bootstrap.inc +1 −1 Original line number Diff line number Diff line Loading @@ -1933,7 +1933,7 @@ function check_plain($text) { * TRUE if the text is valid UTF-8, FALSE if not. */ function drupal_validate_utf8($text) { if (strlen($text) == 0) { if (strlen((string) $text) == 0) { return TRUE; } // With the PCRE_UTF8 modifier 'u', preg_match() fails silently on strings Loading
includes/common.inc +1 −1 Original line number Diff line number Diff line Loading @@ -1500,7 +1500,7 @@ function filter_xss($string, $allowed_tags = array('a', 'em', 'strong', 'cite', // Store the text format. _filter_xss_split($allowed_tags, TRUE); // Remove NULL characters (ignored by some browsers). $string = str_replace(chr(0), '', $string); $string = str_replace(chr(0), '', (string) $string); // Remove Netscape 4 JS entities. $string = preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string); Loading
modules/simpletest/tests/common.test +5 −1 Original line number Diff line number Diff line Loading @@ -480,11 +480,15 @@ class CommonXssUnitTest extends DrupalUnitTestCase { * Check that invalid multi-byte sequences are rejected. */ function testInvalidMultiByte() { // Ignore PHP 8.0+ null deprecatations. // Ignore PHP 8.0+ null deprecations. $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'); $text = filter_xss(NULL); $this->assertEqual($text, '', 'filter_xss() casts null to string'); $text = filter_xss(FALSE); $this->assertEqual($text, '', 'filter_xss() 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"'); Loading