Sergey Biryukov
d3006e8a16
Code Modernization: Use correct default value for JavaScript translations path.
...
The `$path` parameter of `load_script_textdomain()` had a default value of `null`, but would be passed onto the `untrailingslashit()` function without any input validation, even though the latter explicitly only expects/supports a string input.
This commit changes the default value for `$path` to an empty string, and adds an `is_string()` check before passing the value to `untrailingslashit()` to fix the issue at the point where the invalid input is incorrectly (not) validated.
Note: Changing the `untrailingslashit()` function is outside the scope of this commit.
Includes:
* Adding a dedicated unit test for this issue.
* Correcting the default value for `$path` from `null` to an empty string in a few related methods and functions:
* `WP_Dependency::set_translations()`
* `WP_Scripts::set_translations()`
* `wp_set_script_translations()`
* `load_script_textdomain()`
This fix also allows to remove a couple of calls to `expectDeprecation()` in unrelated tests.
Fixes an error when running the test suite:
{{{
4) Tests_Dependencies_Scripts::test_wp_external_wp_i18n_print_order
rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
/var/www/src/wp-includes/formatting.php:2782
/var/www/src/wp-includes/l10n.php:1068
/var/www/src/wp-includes/class.wp-scripts.php:605
/var/www/src/wp-includes/class.wp-scripts.php:320
/var/www/src/wp-includes/class.wp-dependencies.php:136
/var/www/src/wp-includes/functions.wp-scripts.php:109
/var/www/tests/phpunit/tests/dependencies/scripts.php:1505
/var/www/tests/phpunit/includes/utils.php:436
/var/www/tests/phpunit/tests/dependencies/scripts.php:1507
/var/www/vendor/bin/phpunit:123
}}}
Follow-up to [44169], [44607], [51968].
Props jrf, ocean90, Chouby, swissspidy, lovor, iviweb, meysamnorouzi, DarkoG, oneearth27, SergeyBiryukov.
Fixes #55967 . See #55656 .
Built from https://develop.svn.wordpress.org/trunk@54349
git-svn-id: http://core.svn.wordpress.org/trunk@53908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 17:33:18 +00:00
..
2022-09-27 17:32:52 +00:00
2022-04-12 09:26:16 +00:00
2022-09-26 14:58:12 +00:00
2022-09-27 17:32:52 +00:00
2021-10-03 17:51:06 +00:00
2022-09-27 17:32:52 +00:00
2022-09-12 15:47:14 +00:00
2021-11-26 03:06:03 +00:00
2021-11-16 00:04:01 +00:00
2021-05-24 02:18:58 +00:00
2022-09-27 17:32:52 +00:00
2022-04-06 15:20:06 +00:00
2022-08-22 12:26:12 +00:00
2022-09-26 20:56:10 +00:00
2022-02-16 21:19:04 +00:00
2021-12-06 21:30:03 +00:00
2022-09-27 20:13:13 +00:00
2021-12-20 19:33:00 +00:00
2022-09-12 15:47:14 +00:00
2022-09-26 14:00:10 +00:00
2022-09-14 12:48:16 +00:00
2022-03-22 16:25:03 +00:00
2022-03-22 16:25:03 +00:00
2022-09-26 22:43:10 +00:00
2022-08-13 22:44:09 +00:00
2022-04-21 11:24:17 +00:00
2022-09-20 16:26:10 +00:00
2022-09-23 14:00:09 +00:00
2021-08-11 09:08:01 +00:00
2022-09-20 16:29:12 +00:00
2022-09-27 16:33:10 +00:00
2022-09-26 22:43:10 +00:00
2022-09-27 15:43:09 +00:00
2022-06-23 22:57:12 +00:00
2022-08-30 15:17:08 +00:00
2022-07-23 14:58:12 +00:00
2022-07-23 14:58:12 +00:00
2022-04-01 03:25:01 +00:00
2022-09-27 16:31:10 +00:00
2022-08-19 23:06:09 +00:00
2022-08-04 14:52:11 +00:00
2022-06-17 11:20:13 +00:00
2022-08-31 13:41:08 +00:00
2022-06-17 11:20:13 +00:00
2021-05-25 18:47:59 +00:00
2021-12-06 21:30:03 +00:00
2021-12-24 18:06:06 +00:00
2021-01-26 13:45:57 +00:00
2022-01-30 19:25:03 +00:00
2022-01-30 19:25:03 +00:00
2022-01-30 19:25:03 +00:00
2022-09-15 12:32:08 +00:00
2022-05-01 22:01:10 +00:00
2022-01-30 19:25:03 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 15:43:29 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-19 19:51:09 +00:00
2022-09-14 10:52:08 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 21:50:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 14:17:12 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-26 22:43:10 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2021-12-06 21:30:03 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-19 22:53:10 +00:00
2022-09-19 22:53:10 +00:00
2022-09-20 16:59:10 +00:00
2022-09-12 15:47:14 +00:00
2022-09-26 22:10:16 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 14:26:10 +00:00
2022-09-26 22:10:16 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-26 22:10:16 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 11:57:20 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-26 22:10:16 +00:00
2022-09-12 15:47:14 +00:00
2022-09-19 20:49:10 +00:00
2022-09-20 14:17:12 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-28 14:59:10 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-20 13:13:21 +00:00
2022-09-23 21:31:10 +00:00
2022-09-12 15:47:14 +00:00
2022-09-26 10:17:11 +00:00
2022-09-20 01:36:09 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-27 02:18:10 +00:00
2022-09-20 13:12:10 +00:00
2022-09-20 02:51:09 +00:00
2022-09-20 14:17:12 +00:00
2022-09-20 14:17:12 +00:00
2022-09-20 14:17:12 +00:00
2022-09-12 17:52:08 +00:00
2022-08-26 01:03:14 +00:00
2022-05-08 00:29:14 +00:00
2022-09-20 20:32:09 +00:00
2022-06-17 11:20:13 +00:00
2022-09-20 01:36:09 +00:00
2022-09-21 15:06:12 +00:00
2021-05-25 08:27:57 +00:00
2022-09-21 19:48:13 +00:00
2022-06-17 11:20:13 +00:00
2022-08-19 22:06:09 +00:00
2022-04-29 19:17:11 +00:00
2021-11-29 09:52:00 +00:00
2022-06-20 21:46:16 +00:00
2022-09-20 14:17:12 +00:00
2022-09-26 13:07:14 +00:00
2022-04-04 18:26:06 +00:00
2021-11-19 15:14:00 +00:00
2022-09-22 09:26:15 +00:00
2022-09-14 18:44:09 +00:00
2022-09-14 13:08:14 +00:00
2022-08-11 14:11:08 +00:00
2021-02-02 00:10:01 +00:00
2022-09-15 13:29:13 +00:00
2022-09-28 17:33:18 +00:00
2022-09-13 18:05:09 +00:00
2022-09-27 16:31:10 +00:00
2022-09-20 04:02:10 +00:00
2022-09-26 22:43:10 +00:00
2022-08-11 14:03:09 +00:00
2022-09-06 11:28:13 +00:00
2022-07-14 13:35:13 +00:00
2022-09-20 02:51:09 +00:00
2022-09-21 19:48:13 +00:00
2021-07-06 20:21:57 +00:00
2022-09-20 02:51:09 +00:00
2022-05-13 12:21:13 +00:00
2022-09-06 11:28:13 +00:00
2022-08-26 01:03:14 +00:00
2022-02-07 14:01:05 +00:00
2022-06-15 13:37:10 +00:00
2022-09-28 13:44:15 +00:00
2022-09-21 20:24:12 +00:00
2022-08-01 11:15:14 +00:00
2020-11-24 21:27:05 +00:00
2022-09-21 20:24:12 +00:00
2022-03-15 15:22:05 +00:00
2022-09-27 02:00:09 +00:00
2022-06-21 13:34:13 +00:00
2020-11-12 11:17:07 +00:00
2020-11-12 11:17:07 +00:00
2022-09-28 14:04:11 +00:00
2022-09-28 14:47:12 +00:00
2022-08-07 23:05:10 +00:00
2022-04-06 15:33:03 +00:00
2020-11-16 22:52:05 +00:00
2022-03-22 16:25:03 +00:00
2022-09-23 08:27:12 +00:00
2022-09-26 22:43:10 +00:00
2021-05-15 17:38:05 +00:00
2020-11-12 11:17:07 +00:00
2022-09-14 12:48:16 +00:00
2022-09-20 18:53:09 +00:00
2021-12-10 20:30:05 +00:00
2022-09-21 01:09:10 +00:00
2022-09-21 11:43:13 +00:00
2022-05-02 13:13:08 +00:00
2022-09-14 18:44:09 +00:00
2022-09-15 12:20:09 +00:00
2022-09-22 11:13:14 +00:00
2022-09-27 15:23:10 +00:00
2022-04-27 13:47:11 +00:00
2022-09-28 17:33:18 +00:00
2022-06-01 18:14:10 +00:00
2022-07-21 22:45:11 +00:00