diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index b09d69ffb6..bc5ef44366 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php
@@ -2795,7 +2795,7 @@ function wp_opcache_invalidate_directory( $dir ) {
__( '%s expects a non-empty string.' ),
'wp_opcache_invalidate_directory()'
);
- trigger_error( $error_message );
+ wp_trigger_error( '', $error_message );
}
return;
}
diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php
index a56533fbd1..59537e21df 100644
--- a/wp-admin/includes/plugin-install.php
+++ b/wp-admin/includes/plugin-install.php
@@ -174,7 +174,8 @@ function plugins_api( $action, $args = array() ) {
if ( $ssl && is_wp_error( $request ) ) {
if ( ! wp_is_json_request() ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ),
diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php
index 36dc28bac9..64ef380fc4 100644
--- a/wp-admin/includes/theme.php
+++ b/wp-admin/includes/theme.php
@@ -568,7 +568,8 @@ function themes_api( $action, $args = array() ) {
if ( $ssl && is_wp_error( $request ) ) {
if ( ! wp_doing_ajax() ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ),
diff --git a/wp-admin/includes/translation-install.php b/wp-admin/includes/translation-install.php
index 01c61bbb7b..ef9fcc6065 100644
--- a/wp-admin/includes/translation-install.php
+++ b/wp-admin/includes/translation-install.php
@@ -59,7 +59,8 @@ function translations_api( $type, $args = null ) {
$request = wp_remote_post( $url, $options );
if ( $ssl && is_wp_error( $request ) ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ),
diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php
index 9b8b17e058..312289f78e 100644
--- a/wp-admin/includes/update.php
+++ b/wp-admin/includes/update.php
@@ -145,7 +145,8 @@ function get_core_checksums( $version, $locale ) {
$response = wp_remote_get( $url, $options );
if ( $ssl && is_wp_error( $response ) ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ),
diff --git a/wp-admin/link-parse-opml.php b/wp-admin/link-parse-opml.php
index c0f02bd92d..f71b65f419 100644
--- a/wp-admin/link-parse-opml.php
+++ b/wp-admin/link-parse-opml.php
@@ -78,7 +78,7 @@ function endElement( $parser, $tag_name ) { // phpcs:ignore WordPress.NamingConv
// Create an XML parser.
if ( ! function_exists( 'xml_parser_create' ) ) {
- trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
+ wp_trigger_error( '', __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
wp_die( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
}
diff --git a/wp-includes/block-template-utils.php b/wp-includes/block-template-utils.php
index 10ba863c62..2681acb568 100644
--- a/wp-includes/block-template-utils.php
+++ b/wp-includes/block-template-utils.php
@@ -252,7 +252,7 @@ function _filter_block_template_part_area( $type ) {
$type,
WP_TEMPLATE_PART_AREA_UNCATEGORIZED
);
- trigger_error( $warning_message, E_USER_NOTICE );
+ wp_trigger_error( __FUNCTION__, $warning_message );
return WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
}
diff --git a/wp-includes/class-wp-theme-json-resolver.php b/wp-includes/class-wp-theme-json-resolver.php
index 2048304fdf..fca687cfb9 100644
--- a/wp-includes/class-wp-theme-json-resolver.php
+++ b/wp-includes/class-wp-theme-json-resolver.php
@@ -504,7 +504,7 @@ class WP_Theme_JSON_Resolver {
$json_decoding_error = json_last_error();
if ( JSON_ERROR_NONE !== $json_decoding_error ) {
- trigger_error( 'Error when decoding a theme.json schema for user data. ' . json_last_error_msg() );
+ wp_trigger_error( __METHOD__, 'Error when decoding a theme.json schema for user data. ' . json_last_error_msg() );
/**
* Filters the data provided by the user for global styles & settings.
*
diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php
index 4547da40b0..957434de7f 100644
--- a/wp-includes/class-wp-theme-json.php
+++ b/wp-includes/class-wp-theme-json.php
@@ -3775,7 +3775,8 @@ class WP_Theme_JSON {
|| ! is_numeric( $spacing_scale['mediumStep'] )
|| ( '+' !== $spacing_scale['operator'] && '*' !== $spacing_scale['operator'] ) ) {
if ( ! empty( $spacing_scale ) ) {
- trigger_error(
+ wp_trigger_error(
+ __METHOD__,
sprintf(
/* translators: 1: theme.json, 2: settings.spacing.spacingScale */
__( 'Some of the %1$s %2$s values are invalid' ),
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index d9a1ad2bf7..fc95bc5b7d 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -587,7 +587,7 @@ function prep_atom_text_construct( $data ) {
}
if ( ! function_exists( 'xml_parser_create' ) ) {
- trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
+ wp_trigger_error( '', __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
return array( 'html', "" );
}
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 7c03c484dd..2068e5f3a7 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -5518,10 +5518,11 @@ function wp_strip_all_tags( $text, $remove_breaks = false ) {
if ( ! is_scalar( $text ) ) {
/*
* To maintain consistency with pre-PHP 8 error levels,
- * trigger_error() is used to trigger an E_USER_WARNING,
+ * wp_trigger_error() is used to trigger an E_USER_WARNING,
* rather than _doing_it_wrong(), which triggers an E_USER_NOTICE.
*/
- trigger_error(
+ wp_trigger_error(
+ '',
sprintf(
/* translators: 1: The function name, 2: The argument number, 3: The argument name, 4: The expected type, 5: The provided type. */
__( 'Warning: %1$s expects parameter %2$s (%3$s) to be a %4$s, %5$s given.' ),
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 8a955400e9..9c1090f02c 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -4611,7 +4611,8 @@ function wp_json_file_decode( $filename, $options = array() ) {
$filename = wp_normalize_path( realpath( $filename ) );
if ( ! $filename ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Path to the JSON file. */
__( "File %s doesn't exist!" ),
@@ -4625,7 +4626,8 @@ function wp_json_file_decode( $filename, $options = array() ) {
$decoded_file = json_decode( file_get_contents( $filename ), $options['associative'] );
if ( JSON_ERROR_NONE !== json_last_error() ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: 1: Path to the JSON file, 2: Error message. */
__( 'Error when decoding a JSON file at path %1$s: %2$s' ),
@@ -8757,7 +8759,8 @@ function recurse_dirsize( $directory, $exclude = null, $max_execution_time = nul
*/
function clean_dirsize_cache( $path ) {
if ( ! is_string( $path ) || empty( $path ) ) {
- trigger_error(
+ wp_trigger_error(
+ '',
sprintf(
/* translators: 1: Function name, 2: A variable type, like "boolean" or "integer". */
__( '%1$s only accepts a non-empty path string, received %2$s.' ),
diff --git a/wp-includes/ms-default-constants.php b/wp-includes/ms-default-constants.php
index 99d6461f62..3638c3d780 100644
--- a/wp-includes/ms-default-constants.php
+++ b/wp-includes/ms-default-constants.php
@@ -147,7 +147,8 @@ function ms_subdomain_constants() {
);
if ( $subdomain_error_warn ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: 1: VHOST, 2: SUBDOMAIN_INSTALL */
__( 'Conflicting values for the constants %1$s and %2$s. The value of %2$s will be assumed to be your subdomain configuration setting.' ),
diff --git a/wp-includes/rss.php b/wp-includes/rss.php
index 4d3f35e5cb..3304ed0c19 100644
--- a/wp-includes/rss.php
+++ b/wp-includes/rss.php
@@ -63,7 +63,8 @@ class MagpieRSS {
# Check if PHP xml isn't compiled
#
if ( ! function_exists('xml_parser_create') ) {
- return trigger_error( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." );
+ wp_trigger_error( '', "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." );
+ return;
}
$parser = xml_parser_create();
@@ -387,7 +388,7 @@ class MagpieRSS {
function error( $errormsg, $lvl = E_USER_WARNING ) {
if ( MAGPIE_DEBUG ) {
- trigger_error( $errormsg, $lvl);
+ wp_trigger_error('', $errormsg, $lvl);
} else {
error_log( $errormsg, 0);
}
@@ -823,7 +824,7 @@ class RSSCache {
function error ($errormsg, $lvl=E_USER_WARNING) {
$this->ERROR = $errormsg;
if ( MAGPIE_DEBUG ) {
- trigger_error( $errormsg, $lvl);
+ wp_trigger_error( '', $errormsg, $lvl);
}
else {
error_log( $errormsg, 0);
diff --git a/wp-includes/theme.php b/wp-includes/theme.php
index 0dd0975a54..6dbb4cfbef 100644
--- a/wp-includes/theme.php
+++ b/wp-includes/theme.php
@@ -514,7 +514,7 @@ function search_theme_directories( $force = false ) {
// Start with directories in the root of the active theme directory.
$dirs = @ scandir( $theme_root );
if ( ! $dirs ) {
- trigger_error( "$theme_root is not readable", E_USER_NOTICE );
+ wp_trigger_error( __FUNCTION__, "$theme_root is not readable" );
continue;
}
foreach ( $dirs as $dir ) {
@@ -538,7 +538,7 @@ function search_theme_directories( $force = false ) {
*/
$sub_dirs = @ scandir( $theme_root . '/' . $dir );
if ( ! $sub_dirs ) {
- trigger_error( "$theme_root/$dir is not readable", E_USER_NOTICE );
+ wp_trigger_error( __FUNCTION__, "$theme_root/$dir is not readable" );
continue;
}
foreach ( $sub_dirs as $sub_dir ) {
diff --git a/wp-includes/update.php b/wp-includes/update.php
index e2ac6b8b54..d521913bb9 100644
--- a/wp-includes/update.php
+++ b/wp-includes/update.php
@@ -202,7 +202,8 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
$response = wp_remote_post( $url, $options );
if ( $ssl && is_wp_error( $response ) ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ),
@@ -440,7 +441,8 @@ function wp_update_plugins( $extra_stats = array() ) {
$raw_response = wp_remote_post( $url, $options );
if ( $ssl && is_wp_error( $raw_response ) ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ),
@@ -721,7 +723,8 @@ function wp_update_themes( $extra_stats = array() ) {
$raw_response = wp_remote_post( $url, $options );
if ( $ssl && is_wp_error( $raw_response ) ) {
- trigger_error(
+ wp_trigger_error(
+ __FUNCTION__,
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.' ),
diff --git a/wp-includes/version.php b/wp-includes/version.php
index ca41911283..6695f3a513 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.6-beta2-58408';
+$wp_version = '6.6-beta2-58409';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.