mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 20:24:26 +00:00
Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.
Noteable changes: - The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set. - Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors. - Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4. - Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested. See #46732. git-svn-id: https://develop.svn.wordpress.org/trunk@45611 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -994,7 +994,7 @@ function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = fals
|
||||
$string = wp_kses_normalize_entities( $string );
|
||||
}
|
||||
|
||||
$string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
|
||||
$string = htmlspecialchars( $string, $quote_style, $charset, $double_encode );
|
||||
|
||||
// Back-compat.
|
||||
if ( 'single' === $_quote_style ) {
|
||||
@@ -1129,6 +1129,7 @@ function wp_check_invalid_utf8( $string, $strip = false ) {
|
||||
// Check for support for utf8 in the installed PCRE library once and store the result in a static
|
||||
static $utf8_pcre = null;
|
||||
if ( ! isset( $utf8_pcre ) ) {
|
||||
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
|
||||
$utf8_pcre = @preg_match( '/^./u', 'a' );
|
||||
}
|
||||
// We can't demand utf8 in the PCRE installation, so just return the string in those cases
|
||||
@@ -1136,7 +1137,7 @@ function wp_check_invalid_utf8( $string, $strip = false ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
// preg_match fails when it encounters invalid UTF8 in $string
|
||||
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- preg_match fails when it encounters invalid UTF8 in $string
|
||||
if ( 1 === @preg_match( '/^./us', $string ) ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user