This affects:
* `Tests_Rewrite_OldDateRedirect`
* `Tests_Rewrite_OldSlugRedirect`
This commit updates the latter test class to create a post in the `wpSetUpBeforeClass()` method, for consistency with the former class. This ensures that both classes declare the `$post_id` property as `static`, to avoid a situation where non-static access is accidentally used when copying similar test cases from one class to the other.
Follow-up to [34659], [42587], [54077].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54078
git-svn-id: http://core.svn.wordpress.org/trunk@53637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects:
* `Tests_Rewrite_OldDateRedirect::test_old_date_redirect_cache_invalidation()`
* `Tests_Rewrite_OldSlugRedirect::test_old_slug_redirect_cache_invalidation()`
In the former test, the `$post_id` property is declared as `static`, so can only be approached as static, even when used within the same class in which the property is declared.
Using non-static access will result in `null`. See: https://3v4l.org/93HQL
This PHP notice was hidden so far, due to the existence of magic methods in the `WP_UnitTestCase_Base class`.
All the same, the magic methods as they were, would also return `null` for this property. All in all, the post being updated for this test would never get the correct `post_id`.
Fixed by using static access to approach the `static` property.
On a related note, the described bug fix (using the actual `$post_id` instead of `null`) exposed that this test was as a matter of fact failing. This was just hidden by the first bug.
Based on the original commit introducing the test, an adjustment is now made which appears to be what the test actually ''intended'' to test. A similar change is made to the cache invalidation test for old slug redirects. While not strictly required, it brings some consistency between the two tests and ensures that both tests use a unique `post_name` value to avoid collisions with the previous values.
This bug was discovered while fixing (removing) the magic methods in the `WP_UnitTestCase_Base` class in an effort to improve compatibility with PHP 8.2.
Follow-up to [53549].
Props jrf, costdev, SergeyBiryukov.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54077
git-svn-id: http://core.svn.wordpress.org/trunk@53636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
These tests should check the initial `$mysql_recommended_version` and `$mariadb_recommended_version` properties, as `WP_Site_Health::prepare_sql_data()` redefines the former with the latter to simplify further processing if MariaDB is used, leading to a test failure:
{{{
Tests_Site_Health::test_mysql_recommended_version_matches_readme_html
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'5.7'
+'10.3'
}}}
This commit uses the initial property values to ensure the correct versions are being compared.
Follow-up to [54069].
See #55791.
Built from https://develop.svn.wordpress.org/trunk@54076
git-svn-id: http://core.svn.wordpress.org/trunk@53635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This test verifies that the WordPress `readme.html` file recommends a PHP version that is actively supported. However, WordPress currently still recommends PHP 7.4 due to PHP 8.0/8.1 compatibility not being fully achieved, even though PHP 7.4 is end-of-life.
As things were, the assertion in the test was commented out, leading to this test being marked as “risky” for not performing any assertions.
Instead, let’s skip the test with a clear skip notification.
Follow-up to [52260].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54074
git-svn-id: http://core.svn.wordpress.org/trunk@53633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects `Tests_Ajax_MediaEdit::testImageEditOverwriteConstant()`.
In case the `$files_that_should_not_exist` file list is empty, the test would be marked as risky, since it would not perform any assertions.
This small tweak prevents that from happening.
Follow-up to [38113].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54073
git-svn-id: http://core.svn.wordpress.org/trunk@53632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects the following test groups:
* Ajax tests
* ms-files tests
* External HTTP tests
* Xdebug tests
The tests being run in these particular test groups are passing on PHP 8.1, however, the test runs are still allowed to “continue on error”. This creates the risk that new PHP 8.1 incompatibilities will be introduced without anyone noticing.
By no longer allowing these test runs to “continue on error”, that risk is removed.
Follow-up to [51588], [51604], [53922].
Props jrf.
See #55656, #55652.
Built from https://develop.svn.wordpress.org/trunk@54072
git-svn-id: http://core.svn.wordpress.org/trunk@53631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This renames some variables for clarity, per the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions]:
> Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.
* `$out` is renamed to `$output` in various list table methods and admin functions.
* `$sep` is renamed to `$separator` in various list table methods and admin functions.
This affects:
* `WP_Comments_List_Table::handle_row_actions()`
* `WP_List_Table::row_actions()`
* `WP_Media_List_Table::column_default()`
* `WP_MS_Sites_List_Table::site_states()`
* `WP_MS_Users_List_Table::column_blogs()`
* `WP_Terms_List_Table::column_name()`
* `_wp_dashboard_recent_comments_row()`
* `image_align_input_fields()`
* `image_size_input_fields()`
* `wp_doc_link_parse()`
* `_post_states()`
* `_media_states()`
Follow-up to [8653], [8692], [8864], [8910], [8911], [8916], [9103], [9153], [10607], [15491], [17793], [32644], [54070].
Props mukesh27, costdev.
See #56448, #55647.
Built from https://develop.svn.wordpress.org/trunk@54071
git-svn-id: http://core.svn.wordpress.org/trunk@53630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* MySQL 5.6 has reached EOL (“End of Life”) in February 2021. The recommended minimum is bumped to 5.7 for now.
* MariaDB 10.2 has reached EOL in May 2022. The recommended minimum is bumped to 10.3 for now.
This commit brings the Site Health recommendations in line with `readme.html`.
Includes:
* Adding two unit tests to ensure the SQL server versions recommended by Site Health match `readme.html`.
* Consistently declaring the recommended and required versions as the `WP_Site_Health` class properties.
* Renaming some pre-existing private properties for clarity.
Follow-up to [44986], [52319], [52358], [52420], [52424], [53431], [53433], [53435], [meta11407], [meta11866].
See #55791, #meta5999, #meta6322.
Built from https://develop.svn.wordpress.org/trunk@54069
git-svn-id: http://core.svn.wordpress.org/trunk@53628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects:
* `test_user_without_publish_posts_cannot_affect_sticky()`
* `test_user_without_publish_posts_cannot_affect_sticky_with_edit_post()`
In both tests, the user is now set after creating the post, not before. This aims to better match the intention of the tests, as they ensure that a sticky status is unaffected for a post that is ''edited'' by a user without the `publish_posts` capability, not necessarily ''created'' by that user.
Includes minor documentation updates for consistency.
Follow-up to [33096], [35183].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54068
git-svn-id: http://core.svn.wordpress.org/trunk@53627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a "Sorry, you are not allowed to edit this post" error further in the test. The test is currently skipped on GitHub Actions, as only runs on older MySQL versions specifically with the `utf8` character set.
The user was previously set for all tests in the file in the `set_up()` method, however that is no longer the case, as it was not required for the majority of the tests. It is, however, necessary for the `edit_post()` call in this particular test.
Follow-up to [30346], [53785].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54067
git-svn-id: http://core.svn.wordpress.org/trunk@53626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduces the filter `wp_post_class_taxonomies` to allow developers to bypass the generation of term based classes with the `get_post_class()` function.
Developers can use this filter to reduce the number of taxonomies for which classes term classes are generated. This can improve performance on sites with a large number of custom taxonomies.
Props boonebgorges, bordoni, davidbaumwald, desrosj, invelity, mukesh27, sebastianpisula, steveo2000, swissspidy, system909, tlovett1, xparham.
Fixes#37114.
Built from https://develop.svn.wordpress.org/trunk@54066
git-svn-id: http://core.svn.wordpress.org/trunk@53625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates an older fragment in `WP_Site_Health::prepare_sql_data()` to use a dedicated `$wpdb` method introduced later in WordPress 5.5 specifically for retrieving the database server information.
Follow-up to [44986], [47451].
Props hilayt24, mukesh27, Clorith, SergeyBiryukov.
Fixes#56484.
Built from https://develop.svn.wordpress.org/trunk@54065
git-svn-id: http://core.svn.wordpress.org/trunk@53624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
These tags were previously removed to avoid notices when generating the code coverage report on PHP versions where these functions are natively available and not user-defined:
{{{
"@covers ::array_key_first" is invalid
"@covers ::array_key_last" is invalid
"@covers ::hash_hmac" is invalid
"@covers ::is_countable" is invalid
"@covers ::is_iterable" is invalid
"@covers ::mb_strlen" is invalid
"@covers ::mb_substr" is invalid
"@covers ::str_contains" is invalid
"@covers ::str_ends_with" is invalid
"@covers ::str_starts_with" is invalid
}}}
It has been pointed out that those tests do cover the WP implementation of those functions and should be marked as such with a `@covers` tag. The reason PHPUnit displays notices about it, is that code coverage is only run on PHP 7.4 instead of multiple PHP versions.
For those PHP versions which don't natively contain the function, the WP polyfill is being tested and should be seen as covered by tests. The reason the tests are also run on PHP versions in which the function already exists in PHP natively, is to make sure that the polyfill test expectations line up with the PHP native behaviour, even though at that point, they are no longer testing the WP polyfill, but the PHP native function.
With the above in mind, while those PHPUnit notices add some noise to the code coverage report, in this case, they should be ignored and the `@covers` tags should be brought back.
As a potential future enhancement, the code coverage script could be updated to run against the highest and lowest supported PHP versions and with some variations of extensions enabled or disabled to ensure those tests actually test the polyfills.
Follow-up to [51852], [52038], [52039], [52040], [54049], [54060].
Props jrf.
See #39265, #55652.
Built from https://develop.svn.wordpress.org/trunk@54064
git-svn-id: http://core.svn.wordpress.org/trunk@53623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Some assertions were unnecessarily duplicated. They aim to test the function behavior both when passing a term ID and term object, however that is already handled via the `$use_id` parameter of the `get_term()` helper in the same test class. The data providers already supply test cases both with a term ID and term object, so there is no need for a second assertion or a whole second test method with a term object.
* One `get_term_feed_link()` test was unnecessarily skipped half of the time, when term object was passed instead of term ID. Instead, it can use a dedicated data provider and avoid skipping.
Includes:
* Using more descriptive test method names to clarify the intention of the tests.
* Some documentation updates for clarity.
Follow-up to [52180], [52255], [52258], [52305], [53833], [53836].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54061
git-svn-id: http://core.svn.wordpress.org/trunk@53620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `@covers` tags for these tests were previously removed to avoid notices when generating the code coverage report on PHP versions where these functions are natively available and not user-defined:
{{{
"@covers ::array_key_first" is invalid
"@covers ::array_key_last" is invalid
"@covers ::hash_hmac" is invalid
"@covers ::is_countable" is invalid
"@covers ::is_iterable" is invalid
"@covers ::mb_strlen" is invalid
"@covers ::mb_substr" is invalid
"@covers ::str_contains" is invalid
"@covers ::str_ends_with" is invalid
"@covers ::str_starts_with" is invalid
}}}
Explicitly including a `@coversNothing` annotation in this case appears to be a more appropriate option than not including any annotation at all.
Follow-up to [51852], [52038], [52039], [52040], [54049].
See #39265, #55652.
Built from https://develop.svn.wordpress.org/trunk@54060
git-svn-id: http://core.svn.wordpress.org/trunk@53619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
WordPress core test suite uses PHPUnit's `beStrictAboutTestsThatDoNotTestAnything` option set to true, which marks a test as risky when no assertions are performed.
REST API test classes have some empty tests for non-implemented methods because these test classes extend the abstract `WP_Test_REST_Controller_Testcase` class, which requires several methods to be implemented that don't necessarily make sense for all REST API routes.
As these tests are intentionally empty, they were previously marked as skipped, so that they are not reported as risky.
This commit aims to further reduce noise in the test suite and effectively ignores these empty tests altogether, which seems like a more appropriate option at this time.
The `@doesNotPerformAssertions` annotation can be reconsidered in the future when the tests are either removed as unnecessary or updated to actually perform assertions related to their behavior.
Follow-up to [40534], [41176], [41228], [53921].
See #40538, #41463, #55652.
Built from https://develop.svn.wordpress.org/trunk@54058
git-svn-id: http://core.svn.wordpress.org/trunk@53617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses a notice when generating the code coverage report:
{{{
"@covers WP_REST_URL_Details_Controller::get_routes" is invalid
}}}
The `WP_REST_URL_Details_Controller` class does not have a `get_routes()` method, `WP_REST_Server` does.
Follow-up to [51973].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54056
git-svn-id: http://core.svn.wordpress.org/trunk@53615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses a notice when generating the code coverage report:
{{{
"@covers WP_REST_Request::create_item" is invalid
}}}
The `WP_REST_Request` class does not have a `create_item()` method, `WP_REST_Posts_Controller` is the class being tested here.
Includes fixing a typo in the test method name.
Follow-up to [53813].
See #52422, #55652.
Built from https://develop.svn.wordpress.org/trunk@54055
git-svn-id: http://core.svn.wordpress.org/trunk@53614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As `preg_split()` is not a user-defined function, it causes notices when generating the code coverage report:
{{{
"@covers ::preg_split" is invalid
}}}
Instead, it appears that the intention was to test the performance of these WordPress functions:
* `get_html_split_regex()`
* `_get_wptexturize_split_regex()`
* `_get_wptexturize_shortcode_regex()`
Follow-up to [34761], [53562].
See #39265, #55652.
Built from https://develop.svn.wordpress.org/trunk@54051
git-svn-id: http://core.svn.wordpress.org/trunk@53610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As these are not user-defined functions, they cause notices when generating the code coverage report:
{{{
"@covers ::array_key_first" is invalid
"@covers ::array_key_last" is invalid
"@covers ::hash_hmac" is invalid
"@covers ::is_countable" is invalid
"@covers ::is_iterable" is invalid
"@covers ::mb_strlen" is invalid
"@covers ::mb_substr" is invalid
"@covers ::str_contains" is invalid
"@covers ::str_ends_with" is invalid
"@covers ::str_starts_with" is invalid
}}}
Follow-up to [51852], [52038], [52039], [52040].
See #39265, #55652.
Built from https://develop.svn.wordpress.org/trunk@54049
git-svn-id: http://core.svn.wordpress.org/trunk@53608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`wp_enqueue_block_support_styles()` attaches inline styles to the `wp_head` or `wp_footer` actions. This adds a priority parameter to the function to allow the styles to be given a loading order when necessary.
Props bernhard-reiter, ramonopoly.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54048
git-svn-id: http://core.svn.wordpress.org/trunk@53607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add a `@coversDefaultClass` annotation to address `@covers ::get_test_page_cache" is invalid` notices.
* Rename data providers to start with the `data_` prefix and match the test method names, for consistency.
* Move data providers next to the test methods they are used in.
* Move `::get_test_page_cache()` closer to `::get_test_persistent_object_cache()`, for a bit more predictable placement.
* Fix a typo in `::get_test_persistent_object_cache()` description.
Follow-up to [53955], [54043], [54044], [54045].
See #56041.
Built from https://develop.svn.wordpress.org/trunk@54047
git-svn-id: http://core.svn.wordpress.org/trunk@53606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Because `.comments-notes` and `.logged-in-as` paragraphs are centered in Twenty Twenty, words were wrapping poorly to the next line, and even more often with "Edit your profile" displayed as visible text (see [53796]). This changeset ensures the required message is displayed on a new line.
Follow-up to [53796].
Props sabernhardt, audrasjb, mukesh27, nidhidhandhukiya.
Fixes#56397.
Built from https://develop.svn.wordpress.org/trunk@54046
git-svn-id: http://core.svn.wordpress.org/trunk@53605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to avoid a race condition in the Code Coverage Report, which takes longer than 10 minutes to run, and by the time the page cache test runs, the `expires` header that is supposed to be in the future is already in the past.
Follow-up to [54043].
Props Clorith, davidbaumwald, flixos90, desrosj, SergeyBiryukov.
See #56041.
Built from https://develop.svn.wordpress.org/trunk@54045
git-svn-id: http://core.svn.wordpress.org/trunk@53604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Moving leading and trailing spaces out of a translatable string.
* Using the established format for translator comments.
* Using a consistent typography for the apostrophe.
Follow-up to [53955], [54043].
See #56041.
Built from https://develop.svn.wordpress.org/trunk@54044
git-svn-id: http://core.svn.wordpress.org/trunk@53603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds a new `page_cache` check which determines whether the site uses a full page cache, and in addition assesses the server response time. If no page cache is present and the server response time is slow, the check will suggest use of a page cache.
A few filters are included for customization of the check:
* `site_status_good_response_time_threshold` filters the number of milliseconds below which the server response time is considered good. The default value is based on the `server-response-time` Lighthouse audit and can be altered using this filter.
* `site_status_page_cache_supported_cache_headers` filters the map of supported cache headers and their callback to determine whether it was a cache hit. The default list includes commonly used cache headers, and it is filterable to support e.g. additional cache headers used by specific vendors.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, westonruter, spacedmonkey, swissspidy, Clorith.
Fixes#56041.
Built from https://develop.svn.wordpress.org/trunk@54043
git-svn-id: http://core.svn.wordpress.org/trunk@53602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `$editor_id` property is declared as static, so can only be approached as static, even when used within the same class in which the property is declared.
Using non-static access will result in `null`. See: https://3v4l.org/93HQL
This PHP notice was hidden so far, due to the existence of magic methods in the `WP_UnitTestCase_Base` class.
All the same, the magic methods as they were, would also return `null` for this property. All in all, the attachment being created for this test would never get the correct `post_author`.
Fixed by using static access to approach the static property.
This bug was discovered while fixing (removing) the magic methods in the `WP_UnitTestCase_Base` class in an effort to improve compatibility with PHP 8.2.
Follow-up to [38832].
Props jrf, costdev, johnbillion.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54041
git-svn-id: http://core.svn.wordpress.org/trunk@53600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In the `set_up()` method, a copy would be made of the original value of the global `$wp_theme_directories` variable, with the intention to restore that original value in the `tear_down()` method after running each test. Unfortunately, this was not implemented correctly.
* The backup is made to a function local variable in `set_up()` and not stored somewhere where it is accessible from the `tear_down()` method.
* The restoring then references a non-existent property to restore, which would effectively set the `$wp_theme_directories` global to `null`.
Fixed by declaring and using a private property to store the original `$wp_theme_directories` value.
This bug was discovered while fixing (removing) the magic methods in the `WP_UnitTestCase_Base` class in an effort to improve compatibility with PHP 8.2.
Follow-up to [38907].
Props jrf, costdev, johnbillion, swissspidy.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54040
git-svn-id: http://core.svn.wordpress.org/trunk@53599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The correct variable here is `github.run_attempt`, which represents the unique number for each attempt of a particular workflow run in a repository.
The `github.run_number` currently being used represents the unique number for each run of a particular workflow in a repository.
Follow up to [53947].
Fixes#56407.
Built from https://develop.svn.wordpress.org/trunk@54039
git-svn-id: http://core.svn.wordpress.org/trunk@53598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As an adopted library that does not follow the WordPress Coding Standards, the file ended with a mix of tab and spaces as part of maintenance updates over the years.
This commit standardizes on spaces for now, to bring some consistency while minimizing the number of changes.
Includes moving all the declared properties to the top of the class.
Follow-up to [11875], [11877], [23376], [32990], [46377], [54037].
See #55647.
Built from https://develop.svn.wordpress.org/trunk@54038
git-svn-id: http://core.svn.wordpress.org/trunk@53597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.
In this case, the `$use` property, as set in the class constructor, falls in the “known property” category.
Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].
Follow-up to [11875], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948], [53949], [53952], [53953], [53954], [53957].
Props jrf, antonvlasenko, costdev.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@54037
git-svn-id: http://core.svn.wordpress.org/trunk@53596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Convert markup to entities when displaying on the front end. Deprecates `the_meta()` in favor of `get_post_meta()`.
Props tykoted, martinkrcho, xknown, dd32, peterwilsoncc, paulkevan, timothyblynjacobs.
Built from https://develop.svn.wordpress.org/trunk@53958
git-svn-id: http://core.svn.wordpress.org/trunk@53517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.
In this case, the `$_nplurals` and `$_gettext_select_plural_form` properties, both being set in the class constructor, fall in the “known property” category.
Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].
Follow-up to [10584], [12079], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948], [53949], [53952], [53953], [53954].
Props jrf, antonvlasenko, costdev.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53957
git-svn-id: http://core.svn.wordpress.org/trunk@53516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds a new `persistent_object_cache` check which determines whether the site uses a persistent object cache, and if not, recommends it if it is beneficial for the site. A support resource to learn more about object caching has been created and is linked in the check.
A few filters are included for customization of the check, aimed primarily at hosting providers to provide more specific information in regards to their environment:
* `site_status_persistent_object_cache_url` filters the URL to learn more about object caching, so that e.g. a hosting-specific object caching support resource could be linked.
* `site_status_persistent_object_cache_notes` filters the notes added to the check description, so that more fine tuned information on object caching based on the environment can be provided.
* `site_status_should_suggest_persistent_object_cache` is a short-circuit filter which allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.
* `site_status_persistent_object_cache_thresholds` filters the thresholds in the default logic to determine whether a persistent object cache would make sense for the site, which is based on the amount of data in the database.
Note that due to the nature of this check it is only run in production environments.
Props furi3r, tillkruss, spacedmonkey, audrasjb, Clorith.
Fixes#56040.
Built from https://develop.svn.wordpress.org/trunk@53955
git-svn-id: http://core.svn.wordpress.org/trunk@53514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.
In this case, the `$is_overloaded` property and the `$_f` property fall in the “known property” category. In both cases, these are being set in the `__construct()` method of the class they apply to.
The `$_post` property appears to be a typo however. The `$_post` property looks to be unused, while there is an undeclared integer `$_pos` (“position”) property, which is used throughout the class and used by the child classes.
Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].
Follow-up to [11626], [12174], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938], [53942], [53945], [53948], [53949], [53952], [53953].
Props jrf, antonvlasenko, costdev.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53954
git-svn-id: http://core.svn.wordpress.org/trunk@53513 1a063a9b-81f0-0310-95a4-ce76da25c4cd