Any notices in that file happen before `WP_DEBUG` takes effect, and should not be displayed with the `error_reporting` level previously set in `wp-load.php`.
Adding the class when there is no notice displayed results in extra padding under the admin bar, which should be avoided.
Follow-up to [20102], [21025], [26620], [47745].
Props akissz, tw2113, laxman-prajapati, sabernhardt, johnbillion, SergeyBiryukov.
Fixes#51073.
git-svn-id: https://develop.svn.wordpress.org/trunk@48850 602fd350-edb4-49c9-b593-d223f7449a82
As per the documentation of the `@covers` tag, global functions being covered should be prefixed with `::`. Also, the `()` after the function name is redundant.
Follow-up to [39918].
Props jrf.
See #50267.
git-svn-id: https://develop.svn.wordpress.org/trunk@48848 602fd350-edb4-49c9-b593-d223f7449a82
This makes the configuration consistent with the `WP_RUN_CORE_TESTS` constant being set to `1` in the same config file.
Additionally, update the list to be in line with the current codebase, excluding the plugins and themes bundled with WordPress core from being considered for code coverage.
Note: If you have a local `phpunit.xml` file that changes the `WP_RUN_CORE_TESTS` constant to `0`, you should also - in the same file - change the code coverage setup to use the `src` directory.
Follow-up to [42665], [43311].
Props jrf, mmarco9.
See #50267.
git-svn-id: https://develop.svn.wordpress.org/trunk@48847 602fd350-edb4-49c9-b593-d223f7449a82
This fixes random test failures when one of the term IDs from previous tests coincides with the orphan term ID from this test that should not be lazy-loaded.
Follow-up to [34529], [36566].
Fixes#51109.
git-svn-id: https://develop.svn.wordpress.org/trunk@48844 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a PHP notice if the API returns a plugin with empty data for `blocks` key.
Props khag7, TwentyZeroTwo, justinahinon, TimothyBlynJacobs, dd32, SergeyBiryukov.
Fixes#51018.
git-svn-id: https://develop.svn.wordpress.org/trunk@48842 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a PHP 8 "Only the first byte will be assigned to the string offset" warning on Edit Post screen.
The correct usage of `wp_localize_script()` is to pass an array of data, not a string.
Fixes#51108.
git-svn-id: https://develop.svn.wordpress.org/trunk@48841 602fd350-edb4-49c9-b593-d223f7449a82
This brings `wp_count_terms()` in line with other taxonomy functions such as `get_terms()` which technically no longer require a taxonomy. Similar to the previously modified functions, no deprecation warning is triggered when using the legacy signature.
Fixes#36399.
git-svn-id: https://develop.svn.wordpress.org/trunk@48840 602fd350-edb4-49c9-b593-d223f7449a82
As per the documentation of `call_user_func_array()`, the `$param_arr` should be a (numerically) indexed array, not a string-keyed array.
As we can use the spread operator in PHP 5.6+, there isn't really any need to use `call_user_func_array()` anyhow, we can call the `array_merge()` function directly.
The caveat to this is that the spread operator only works on numerically indexed arrays, so we need to wrap the `$sidebars_widgets` variable in a call to `array_values()` when using the spread operator.
Using `array_values()` in the existing `call_user_func_array()` call would also have solved this, but the solution now proposed, has the added benefit of getting rid of the overhead of `call_user_func_array()`.
Props jrf.
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@48839 602fd350-edb4-49c9-b593-d223f7449a82
The WP native `get_comment()` function expects the first argument `$comment` to be passed by reference.
The PHP `array_map()` function, however, passes by value, not by reference, resulting in an "arguments must be passed by reference, value given" error.
The PHP native `array_walk()` function does pass by reference. Using this prevents the error on PHP 8 and maintains the existing behaviour on PHP < 8.
Props jrf.
See #50913.
git-svn-id: https://develop.svn.wordpress.org/trunk@48838 602fd350-edb4-49c9-b593-d223f7449a82
When iterating over the items stored in '_wp_suggested_privacy_policy_content` meta value for the Privacy Policy page, make sure the item is an array before accessing its properties.
Props treibstoff.
Fixes#51084.
git-svn-id: https://develop.svn.wordpress.org/trunk@48836 602fd350-edb4-49c9-b593-d223f7449a82
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.
Props laxman-prajapati.
Fixes#51077.
git-svn-id: https://develop.svn.wordpress.org/trunk@48834 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the labels for the reusable block post type were just “block”. The document settings tab in the block editor has been changed to use the post type label specified instead to be more specific. Changing the reusable block post type labels to “reusable block” prevents two “Block” tabs from showing in the editor.
Props desaiuditd, peterwilsoncc.
Fixes#50755.
git-svn-id: https://develop.svn.wordpress.org/trunk@48829 602fd350-edb4-49c9-b593-d223f7449a82
This addresses a regression in [47808], which caused excerpts to be generated from post content if an empty string is passed, but not for other values considered empty, e.g. `null` or `false`.
Props riaanlom, laxman-prajapati, SergeyBiryukov.
Fixes#51042.
git-svn-id: https://develop.svn.wordpress.org/trunk@48817 602fd350-edb4-49c9-b593-d223f7449a82
The links is unnecessary there, as the toolbar is the first thing in the DOM within the `<body>` element.
For themes that don't implement the `wp_body_open` action yet and render the admin bar in the footer, the "Skip to toolbar" link with `tabindex="1"` is still necessary, to ensure it's the first focusable element in the page.
Props sarahricker, afercia, erikjandelange, audrasjb.
Fixes#50702.
git-svn-id: https://develop.svn.wordpress.org/trunk@48812 602fd350-edb4-49c9-b593-d223f7449a82
This avoids PHP notices if these keys were accidentally removed using the `site_status_tests` filter.
Props khag7, Ov3rfly, desrosj, Clorith.
Fixes#50858.
git-svn-id: https://develop.svn.wordpress.org/trunk@48808 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the warning was displayed even if the value was higher than `upload_max_filesize`, which made the report inaccurate, as these values don't necessarily have to match.
Props oakesjosh, jeroenrotty, desrosj, Clorith.
Fixes#50945.
git-svn-id: https://develop.svn.wordpress.org/trunk@48800 602fd350-edb4-49c9-b593-d223f7449a82
In PHP 8, the GD extension uses `GdImage` objects instead of resources for its underlying data structures.
This updates the existing `is_resource()` calls for image resources in core to accomodate for `GdImage` instances as well.
Props ayeshrajans, jrf.
Fixes#50833.
git-svn-id: https://develop.svn.wordpress.org/trunk@48798 602fd350-edb4-49c9-b593-d223f7449a82
Support for the `uniqueItems` keyword was added in [48357], but wasn't included in the list of permitted keywords for `WP_REST_Controller::get_endpoint_args_for_item_schema()`. This prevented the keyword from being automatically supported if specified in a controller's item schema.
Fixes#51021.
git-svn-id: https://develop.svn.wordpress.org/trunk@48796 602fd350-edb4-49c9-b593-d223f7449a82
The function is private (only intended for core usage) and is hooked to the `delete_post` action, which always passes a non-zero post ID.
Follow-up to [14295], [48794].
See #50343.
git-svn-id: https://develop.svn.wordpress.org/trunk@48795 602fd350-edb4-49c9-b593-d223f7449a82
As it already was not possible to pass the required parameters without also passing the optional one anyway, removing the default value for the (not so) optional parameters should not affect backward compatibility.
This change affects three functions in core:
* `get_comment_delimited_block_content()`
* `do_enclose()`
* `_wp_delete_tax_menu_item()`
Props jrf, ayeshrajans, desrosj.
Fixes#50343.
git-svn-id: https://develop.svn.wordpress.org/trunk@48794 602fd350-edb4-49c9-b593-d223f7449a82
Previously, it was only incidentally recognized as valid due to a loose comparison with `true`.
With the strict comparison added to `WP_Site_Health_Auto_Updates::test_constants()`, this was no longer the case.
Follow-up to [47841].
Props sterndata, mukesh27, avixansa, desrosj, SergeyBiryukov.
Fixes#50912.
git-svn-id: https://develop.svn.wordpress.org/trunk@48792 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that those settings don't leak to other tests.
Props david.binda, TimothyBlynJacobs, SergeyBiryukov.
Fixes#50986.
git-svn-id: https://develop.svn.wordpress.org/trunk@48791 602fd350-edb4-49c9-b593-d223f7449a82
`create_function()` has been deprecated in PHP >= 7.2 and removed in PHP 8.
The only instance left in core was used in a test that was being skipped on PHP >= 7.2. This allows the test to run again.
Follow-up to [41722], [41730].
Props jrf.
Fixes#50899.
git-svn-id: https://develop.svn.wordpress.org/trunk@48790 602fd350-edb4-49c9-b593-d223f7449a82