This avoids an `Undefined array key 0` PHP warning for `current_user_can()` capability checks that require a specific object to check against but an object ID was not passed.
A `_doing_it_wrong()` notice is also added, so that developers and site administrators are aware that the capability mapping is failing in the absence of the required object ID.
The list of mapped capabilities that require an object ID:
* `delete_post` / `delete_page`
* `edit_post` / `edit_page`
* `read_post` / `read_page`
* `publish_post`
* `edit_(post|comment|term|user)_meta` / `delete_*_meta` / `add_*_meta`
* `edit_comment`
* `edit_term` / `delete_term` / `assign_term`
Follow-up to [34091], [34113], [47178].
Props jeherve, peterwilsoncc, henry.wright, johnbillion, mattheweppelsheimer, hellofromTonya, JeffPaul, azouamauriac, Ninos Ego, TobiasBg, wpsmith, GaryJ, nacin, johnstonphilip, azaozz, SergeyBiryukov.
Fixes#44591.
Built from https://develop.svn.wordpress.org/trunk@53408
git-svn-id: http://core.svn.wordpress.org/trunk@52997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When called too early, conditional query tags should throw a `_doing_it_wrong()` notice and return `false`. This commit verifies that behavior not only for `is_main_query()`, but for all the other conditional tags too.
Follow-up to [16947], [17068], [17083], [18699], [37985], [53395].
See #55104.
Built from https://develop.svn.wordpress.org/trunk@53396
git-svn-id: http://core.svn.wordpress.org/trunk@52985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a PHP fatal error and triggers a `_doing_it_wrong()` notice if `is_main_query()` is called too early, bringing consistency with all the other `is_*()` conditionals: `is_single()`, `is_home()`, etc.
Follow-up to [16947], [17068], [17083], [18699], [37985].
Props vdankbaar, nhadsall, johnbillion, costdev, thijsoo, teunvgisteren, timkersten655, SergeyBiryukov.
Fixes#55104.
Built from https://develop.svn.wordpress.org/trunk@53395
git-svn-id: http://core.svn.wordpress.org/trunk@52984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This replaces the references to “MySQL” with “your host’s database server” on the “Error establishing a database connection” page when Multisite could not be loaded. The generic “database server” term can refer to MySQL or MariaDB. Additionally, this brings some consistency with a similar error message in `wpdb::db_connect()`.
Follow-up to [52367], [52423].
Props tj692, hansjovisyoast, tobifjellner.
Fixes#55701.
Built from https://develop.svn.wordpress.org/trunk@53394
git-svn-id: http://core.svn.wordpress.org/trunk@52983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Backport of the remaining Comment Template block tests from Gutenberg:
* `assertEquals()` replaced with `assertSameSetsWithIndex()`.
* assertion's argument order changed to ensure expected and then actual.
Follow-up to [53353], [53298], [53172], [53138].
Props bernhard-reiter.
Fixes#55708.
Built from https://develop.svn.wordpress.org/trunk@53388
git-svn-id: http://core.svn.wordpress.org/trunk@52977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is a defensive coding measure that aims to reduce confusion. With this change, `$pieces` is explicitly used for the names, and `$clauses` for the values of the clauses.
Follow-up to [52974], [53175], [53370], [53375].
Props peterwilsoncc.
See #55699.
Built from https://develop.svn.wordpress.org/trunk@53376
git-svn-id: http://core.svn.wordpress.org/trunk@52965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is a defensive coding measure that aims to reduce confusion. With this change, `$pieces` is explicitly used for the names, and `$clauses` for the values of the clauses.
Follow-up to [52974], [53175], [53370].
Props peterwilsoncc.
See #55699.
Built from https://develop.svn.wordpress.org/trunk@53375
git-svn-id: http://core.svn.wordpress.org/trunk@52964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replace error suppressing in `wp_filesize()` with a `file_exists()` check before calling the native PHP `filesize()` function.
Follow up to [52837].
Props Cybr, johnbillion, spacedmonkey, antpb, azouamauriac, ironprogrammer, mukesh27, costdev, audrasjb, dlh.
Fixes#55678.
See #49412.
Built from https://develop.svn.wordpress.org/trunk@53372
git-svn-id: http://core.svn.wordpress.org/trunk@52961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since this is an admin template function and the tests check for specific output with certain taxonomy parameters, placing the tests along with other tests for the functions in the same file should make them easier to find and extend than when placed between general taxonomy registration tests.
Follow-up to [52841], [53368].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53371
git-svn-id: http://core.svn.wordpress.org/trunk@52960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses a backward compatibility break where `posts_join_request` and other filters were applied, but their results were subsequently discarded and earlier values were used instead.
Follow-up to [52974], [53175].
Props 5um17, johnbillion, SergeyBiryukov.
Fixes#55699.
Built from https://develop.svn.wordpress.org/trunk@53370
git-svn-id: http://core.svn.wordpress.org/trunk@52959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Additional tests to ensure taxonomies show in the quick/bulk edit froms based on the `show_in_quick_edit` setting rather than the the `show_ui` setting.
Follow up to [52841,31307].
Props figureone, costdev, audrasjb.
Fixes#49701.
Built from https://develop.svn.wordpress.org/trunk@53368
git-svn-id: http://core.svn.wordpress.org/trunk@52957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that parameter names for PHP polyfills in WordPress core 100% match the native PHP parameter names. Otherwise using named parameters with those functions could cause fatal errors for installs where the polyfills kick in.
This commit:
* Renames the `$string` parameter to `$message` in `_()` polyfill.
* Renames the `$str` parameter to `$string` in `mb_substr()` and `mb_strlen()` polyfills.
* Renames the `$raw_output` parameter to `$binary` in `hash_hmac()` polyfill.
* Renames the `$a` and `$b` parameters to `$known_string` and `$user_string` in `hash_equals()` polyfill.
* Renames the `$var` parameter to `$value` in `is_countable()` and `is_iterable()` polyfills.
* Renames the `$arr` parameter to `$array` in `array_key_first()` and `array_key_last()` polyfills.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55650.
Built from https://develop.svn.wordpress.org/trunk@53365
git-svn-id: http://core.svn.wordpress.org/trunk@52954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$parent` parameter to `$parent_page` in `parent_dropdown()`.
Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55650.
Built from https://develop.svn.wordpress.org/trunk@53364
git-svn-id: http://core.svn.wordpress.org/trunk@52953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Restore behaviour of `fields` parameter in `WP_User_Query` to allow developers to specify any database field to be returned either individually or as part of a subset. Add these fields to the documentation.
When a subset of `fields` includes the `id` paramater, include it in the results in both upper and lowercase to maintain backward compatibility.
Follow up to [53327].
Props dd32, pbearne, kraftbj, peterwilsoncc.
Fixes#53177.
Built from https://develop.svn.wordpress.org/trunk@53362
git-svn-id: http://core.svn.wordpress.org/trunk@52951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prevent concatenation of scripts if the text domain is defined to ensure the dependency order is respected.
This accounts for an edge case in which replacing a core script via a plugin and a lack of translations (eg, for a US English site) could cause the JavaScript files to be ordered incorrectly.
Follow up to [52937].
Props audrasjb, boniu91, chaion07, costdev, hellofromtonya, jsnajdr, mukesh27, ndiego, ugyensupport.
Fixes#55628.
Built from https://develop.svn.wordpress.org/trunk@53360
git-svn-id: http://core.svn.wordpress.org/trunk@52949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `amd64/mysql` and `amd64/mariadb` official images from Docker are compatible with x86 running on the ARM64v8 architecture of M1 machines.
Props afragen, justinahinon, desrosj, talldanwp, antonvlasenko, gziolo, aristath, johnbillion
Fixes#52356
Built from https://develop.svn.wordpress.org/trunk@53358
git-svn-id: http://core.svn.wordpress.org/trunk@52947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Backport of 2 tests from Gutenberg for the Comment Template block:
* test line and paragraph breaks are converted into HTML tags.
* test rendering of unapproved comment preview.
Follow-up to [53298], [53172], [53138].
Props bernhard-reiter, darerodz, gziolo, peterwilsoncc, hellofromTonya.
Fixes#55643.
See #55634.
Built from https://develop.svn.wordpress.org/trunk@53353
git-svn-id: http://core.svn.wordpress.org/trunk@52942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Rename `#inline-edit-legend` to avoid duplicate HTML IDs. These have been renamed `#quick-edit-legend` and `#bulk-edit-legend` for the quick and bulk editors respectively.
This HTML ID is not required by the quick editor duplicated via JavaScript so is removed as part of the duplication process.
Follow up to [53096].
Props azaozz, costdev, greglone, hellofromtonya, ironprogrammer, joedolson, sabernhardt.
Fixes#55575.
See #35483.
Built from https://develop.svn.wordpress.org/trunk@53352
git-svn-id: http://core.svn.wordpress.org/trunk@52941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that `WP_UnitTestCase::skipOnAutomatedBranches()` has access to the `GITHUB_REF` and `GITHUB_EVENT_NAME` variables, so that some tests can be skipped when appropriate.
Additionally, account for renaming the `master` branch to `trunk` in November 2021.
Follow-up to [40241], [46999], [49264], [49267], [51868].
Fixes#55668.
Built from https://develop.svn.wordpress.org/trunk@53349
git-svn-id: http://core.svn.wordpress.org/trunk@52938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
After subtracing `0.1` from a `X.1` current version, the result was a single digit without the `.0` decimal. Using `number_format()` ensures each current version has a decimal before appending the `.x` before the test.
This commit also reverts [55346] which was a temporary workaround.
Follow-up to [55346], [47403].
Fixes#55667.
Built from https://develop.svn.wordpress.org/trunk@53347
git-svn-id: http://core.svn.wordpress.org/trunk@52936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is the start of the WordPress 6.0 about page, introducing new content and a first pass of the new style.
Props fcoveram, estelaris, JeffPaul, critterverse, chanthaboune, dansoschin, webcommsat, annezazu, marybaum, cbringmann, eidolonnight, laurlittle, sergeybiryukov.
See #55434.
Built from https://develop.svn.wordpress.org/trunk@53339
git-svn-id: http://core.svn.wordpress.org/trunk@52928 1a063a9b-81f0-0310-95a4-ce76da25c4cd