diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php
index f15775c87f49c..6a63f12a57b39 100644
--- a/src/wp-includes/l10n.php
+++ b/src/wp-includes/l10n.php
@@ -1058,14 +1058,17 @@ function load_child_theme_textdomain( $domain, $path = false ) {
* @return string|false The translated strings in JSON encoding on success,
* false if the script textdomain could not be loaded.
*/
-function load_script_textdomain( $handle, $domain = 'default', $path = null ) {
+function load_script_textdomain( $handle, $domain = 'default', $path = '' ) {
$wp_scripts = wp_scripts();
if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
return false;
}
- $path = untrailingslashit( $path );
+ if ( is_string( $path ) ) {
+ $path = untrailingslashit( $path );
+ }
+
$locale = determine_locale();
// If a path was given and the handle file exists simply return it.
diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php
index ea3bc7bf718cc..b64edfeff9e2d 100644
--- a/tests/phpunit/tests/dependencies/scripts.php
+++ b/tests/phpunit/tests/dependencies/scripts.php
@@ -721,16 +721,6 @@ public function test_wp_add_inline_script_before_after_concat_with_core_dependen
$wp_scripts->base_url = '';
$wp_scripts->do_concat = true;
- if ( PHP_VERSION_ID >= 80100 ) {
- /*
- * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in
- * via hooked in filter functions until a more structural solution to the
- * "missing input validation" conundrum has been architected and implemented.
- */
- $this->expectDeprecation();
- $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' );
- }
-
$ver = get_bloginfo( 'version' );
$suffix = wp_scripts_get_suffix();
$expected = "\n";
@@ -783,16 +773,6 @@ public function test_wp_add_inline_script_customize_dependency() {
$wp_scripts->base_url = '';
$wp_scripts->do_concat = true;
- if ( PHP_VERSION_ID >= 80100 ) {
- /*
- * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in
- * via hooked in filter functions until a more structural solution to the
- * "missing input validation" conundrum has been architected and implemented.
- */
- $this->expectDeprecation();
- $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' );
- }
-
$expected_tail = "\n";
$expected_tail .= "