A truthy check is more in line with similar checks elsewhere, including conditionals in the same exact code block.
Follow-up to [10275], [34696].
Props aristath, poena, afercia, SergeyBiryukov.
See #58831.
git-svn-id: https://develop.svn.wordpress.org/trunk@56360 602fd350-edb4-49c9-b593-d223f7449a82
Prior to this change, the `locate_template()` function would unconditionally check whether the relevant template file exists in the parent theme, which for sites not using a child theme is an exact duplicate of the previous check. This is wasteful and has a small impact on performance since `file_exists()` checks have a cost.
Props nihar007, thekt12, spacedmonkey, mukesh27.
Fixes#58576.
git-svn-id: https://develop.svn.wordpress.org/trunk@56357 602fd350-edb4-49c9-b593-d223f7449a82
Changes "define" to "declare" in the deprecation message in `WP_List_Table` magic methods.
Why is "declare" better?
It aligns well to:
* the topic of and published information about dynamic properties.
* the act of explicitly listing the variable as a property on the class.
The goal of this message is guide developers to change their code. Changing the term to "declare" hopefully will aid in the understanding of what is being asked of developers when this deprecation is thrown.
Follow-up [56349].
Props hellofromTonya, antonvlasenko.
Fixes#58896.
git-svn-id: https://develop.svn.wordpress.org/trunk@56356 602fd350-edb4-49c9-b593-d223f7449a82
The unknown use of unknown dynamic property within the `WP_Text_Diff_Renderer_Table` property magic methods is now deprecated. A descriptive deprecation notice is provided to alert developers to declare the property on the child class extending `WP_Text_Diff_Renderer_Table`.
Changes in this commit:
* Adds a deprecation notice to the `__get()`, `__set()`, `__isset()`, `__unset()` magic methods, i.e. to alert and inform developers when attempting to get/set/isset/unset a dynamic property.
* Fixes `__get()` to explicitly returns `null` when attempting to get a dynamic property.
* Fixes `__set()` by removing the value return after setting a declared property, as (a) unnecessary and (b) `__set()` should return `void` [https://www.php.net/manual/en/language.oop5.overloading.php#object.set per the PHP handbook].
* Fixes `__isset()` to return `false` if not in the `$compat_fields`, as `isset()` and `__isset()` should always return `bool`:
* [https://www.php.net/manual/en/language.oop5.overloading.php#object.isset `__isset()` in the PHP manual]
* [https://www.php.net/manual/en/function.isset.php `isset()` in the PHP manual]
* Adds a test class with happy and unhappy paths for these changes.
For backward compatibility, no changes are made to the internal declared properties listed in `$compat_fields` and accessed through the magic methods.
For example:
A child class uses a property named `$data` that is not declared as a property on the child class. When getting its value, e.g. `$user_query->data`, the `WP_Text_Diff_Renderer_Table::__get()` magic method is invoked, the following deprecation notice thrown, and `null` returned:
>The property `data` is not declared. Setting a dynamic property is deprecated since version 6.4.0! Instead, declare the property on the class.
=== Why not remove the magic methods, remove the `$compat_fields` property, and restore the properties `public`?
tl;dr Backward compatibility.
If a plugin adds a property to `$compat_fields` array, then sites using that plugin would experience (a) an `Undefined property` `Warning` (PHP 8) | `Notice` (PHP 7) and (b) a possible change in behavior.
=== Why not limit the deprecation for PHP versions >= 8.2?
tl;dr original design intent and inform
The magic methods and `$compat_fields` property were added for one purpose: to continue providing external access to internal properties declared on `WP_Text_Diff_Renderer_Table`. They were not intended to be used for dynamic properties.
Deprecating that unintended usage both alerts developers a change is needed in their child class and informs them what to change.
References:
* Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
* A [https://www.youtube.com/live/vDZWepDQQVE?feature=share&t=10097 live open public working session] where these changes were discussed and agreed to.
* [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties.]
Follow-up to [28525], [31135].
Props antonvlasenko, rajinsharwar, jrf, markjaquith, hellofromTonya, SergeyBiryukov, desrosj, peterwilsoncc, audrasjb, costdev, oglekler, jeffpaul.
Fixes#58898.
See #56034.
git-svn-id: https://develop.svn.wordpress.org/trunk@56354 602fd350-edb4-49c9-b593-d223f7449a82
The unknown use of unknown dynamic property within the `WP_User_Query` property magic methods is now deprecated. A descriptive deprecation notice is provided to alert developers to declare the property on the child class extending `WP_User_Query`.
Changes in this commit:
* Adds a deprecation notice to the `__get()`, `__set()`, `__isset()`, `__unset()` magic methods, i.e. to alert and inform developers when attempting to get/set/isset/unset a dynamic property.
* Fixes `__get()` to explicitly returns `null` when attempting to get a dynamic property.
* Fixes `__set()` by removing the value return after setting a declared property, as (a) unnecessary and (b) `__set()` should return `void` [https://www.php.net/manual/en/language.oop5.overloading.php#object.set per the PHP handbook].
* Fixes `__isset()` to return `false` if not in the `$compat_fields`, as `isset()` and `__isset()` should always return `bool`:
* [https://www.php.net/manual/en/language.oop5.overloading.php#object.isset `__isset()` in the PHP manual]
* [https://www.php.net/manual/en/function.isset.php `isset()` in the PHP manual]
* Adds unit tests for happy and unhappy paths.
For backward compatibility, no changes are made to the internal declared properties listed in `$compat_fields` and accessed through the magic methods.
For example:
A child class uses a property named `$data` that is not declared as a property on the child class. When getting its value, e.g. `$user_query->data`, the `WP_User_Query::__get()` magic method is invoked, the following deprecation notice thrown, and `null` returned:
>The property `data` is not declared. Setting a dynamic property is deprecated since version 6.4.0! Instead, declare the property on the class.
=== Why not remove the magic methods, remove the `$compat_fields` property, and restore the properties `public`?
tl;dr Backward compatibility.
If a plugin adds a property to `$compat_fields` array, then sites using that plugin would experience (a) an `Undefined property` `Warning` (PHP 8) | `Notice` (PHP 7) and (b) a possible change in behavior.
=== Why not limit the deprecation for PHP versions >= 8.2?
tl;dr original design intent and inform
The magic methods and `$compat_fields` property were added for one purpose: to continue providing external access to internal properties declared on `WP_User_Query`. They were not intended to be used for dynamic properties.
Deprecating that unintended usage both alerts developers a change is needed in their child class and informs them what to change.
References:
* Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
* A [https://www.youtube.com/live/vDZWepDQQVE?feature=share&t=10097 live open public working session] where these changes were discussed and agreed to.
* [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties.]
Related to #14579, #27881, #30891.
Follow-up to [15491], [28528], [31144].
Props antonvlasenko, rajinsharwar, jrf, markjaquith, hellofromTonya, SergeyBiryukov, desrosj, peterwilsoncc, audrasjb, costdev, oglekler, jeffpaul.
Fixes#58897.
See #56034.
git-svn-id: https://develop.svn.wordpress.org/trunk@56353 602fd350-edb4-49c9-b593-d223f7449a82
This is a micro-optimization that removes a few unnecessary function calls.
Follow-up to [31188], [34369], [38986], [41159], [43211], [43230], [44606], [45757].
Props ayeshrajans, jrf, rajinsharwar, costdev, mukesh27, SergeyBiryukov.
Fixes#58943.
git-svn-id: https://develop.svn.wordpress.org/trunk@56352 602fd350-edb4-49c9-b593-d223f7449a82
Reverts the accidental downgrade of uuid in [56065] by changing it back to 9.0.0.
Props Hareesh Pillai, JeffPaul, audrasjb.
Fixes#58623.
git-svn-id: https://develop.svn.wordpress.org/trunk@56350 602fd350-edb4-49c9-b593-d223f7449a82
The unknown use of unknown dynamic property within the `WP_List_Table` property magic methods is now deprecated. A descriptive deprecation notice is provided to alert developers to declare the property on the child class extending `WP_List_Table`.
Changes in this commit:
* Adds a deprecation notice to the `__get()`, `__set()`, `__isset()`, `__unset()` magic methods, i.e. to alert and inform developers when attempting to get/set/isset/unset a dynamic property.
* Fixes `__get()` to explicitly returns `null` when attempting to get a dynamic property.
* Removes returning the value when setting a declared property, as (a) unnecessary and (b) `__set()` should return `void` [https://www.php.net/manual/en/language.oop5.overloading.php#object.set per the PHP handbook].
* Adds unit tests for happy and unhappy paths.
For backward compatibility, no changes are made to the internal declared properties listed in `$compat_fields` and accessed through the magic methods.
For example:
A child class uses a property named `$data` that is not declared / defined as a property on the child class. When getting its value, e.g. `$list_table->data`, the `WP_List_Table::__get()` magic method is invoked, the following deprecation notice thrown, and `null` returned:
>The property `data` is not defined. Setting a dynamic (undefined) property is deprecated since version 6.4.0! Instead, define the property on the class.
=== Why not remove the magic methods, remove the `$compat_fields` property, and restore the properties `public`?
tl;dr Backward compatibility.
Several plugins, one of which has over 5M installs, add a property to the `$compat_fields` array. Removing the property would cause an `Undefined property` `Warning` (PHP 8) | `Notice` (PHP 7) to be thrown. Removing the associated code would change the functionality.
=== Why not limit the deprecation for PHP versions >= 8.2?
tl;dr original design intent and inform
The magic methods and `$compat_fields` property were added for one purpose: to continue providing external access to internal properties declared on `WP_List_Table`. They were not intended to be used for dynamic properties.
Deprecating that unintended usage both alerts developers a change is needed in their child class and informs them what to change.
References:
* Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
* A [https://www.youtube.com/live/vDZWepDQQVE?feature=share&t=10097 live open public working session] where these changes were discussed and agreed to.
* [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties.]
Related to #14579, #22234, #30891.
Follow-up to [15491], [28493], [28521], [28524], [31146].
Props antonvlasenko, jrf, markjaquith, hellofromTonya, SergeyBiryukov, desrosj, peterwilsoncc, audrasjb, costdev, oglekler, jeffpaul.
Fixes#58896.
See #56034.
git-svn-id: https://develop.svn.wordpress.org/trunk@56349 602fd350-edb4-49c9-b593-d223f7449a82
Fixes `WP_List_table` tests leaking into other tests by:
* Restores the original `$hook_suffix` global value.
Rather than modifying the global for all tests, it now restores the original value between tests. Why? To ensure each test starts at a known state.
* Uses a new instance of `WP_List_Table` for each test.
A test may modify the `$list_table` object. If it does, it could impact tests yet to run. By instantiating a new instance in the `set_up()` test fixture, each test is isolated from the others.
Follow-up to [53868], [54215].
Props hellofromTonya, antonvlasenko.
See #58955, #58896.
git-svn-id: https://develop.svn.wordpress.org/trunk@56348 602fd350-edb4-49c9-b593-d223f7449a82
While the `wp_get_loading_optimization_attributes()` function was only recently introduced in 6.3, its code was mostly ported over from the now deprecated `wp_get_loading_attr_default()` function introduced in 5.5.
That function started out in a simple way, but over time was expanded with more and more conditionals on when to avoid lazy-loading, which ended up making the logic extremely complex and hard to follow.
This changeset refactors the logic to simplify it, in a way that allows to follow it more sequentially, and without making any functional changes, ensuring that the extensive existing unit test coverage still passes. This will facilitate future enhancements to the function to be less error-prone and make it more accessible to new contributors.
Props flixos90, joemcgill.
Fixes#58891.
git-svn-id: https://develop.svn.wordpress.org/trunk@56347 602fd350-edb4-49c9-b593-d223f7449a82
This is a micro-optimization that removes an unnecessary function call.
Follow-up to [44986], [45156].
Props ayeshrajans, jrf, mukesh27, rmccue.
Fixes#58942.
git-svn-id: https://develop.svn.wordpress.org/trunk@56346 602fd350-edb4-49c9-b593-d223f7449a82
With the minimum PHP version requirement raised to 7.0, we can now use `isset` on constants that are arrays. Since `isset` is slightly faster than `array_key_exists` (and the different handling of `null` values is irrelevant for the updates here), remaining instances of `array_key_exists` in the `WP_Theme_JSON` class are replaced in this changeset.
Props soean.
Fixes#57067.
git-svn-id: https://develop.svn.wordpress.org/trunk@56345 602fd350-edb4-49c9-b593-d223f7449a82
With the introduction of temporary backups of plugins and themes before updating, a new Site Health test was added to verify that plugin and theme temporary backup directories are writable or can be created.
When using a non-direct filesystem, the Site Health test did not include the required credentials, leading to a fatal error as the connection was not initialized properly.
This commit attemps to use the stored credentials if available, and displays a message otherwise.
Includes a similar fix in a function that performs a cleanup of the temporary backup directory.
Follow-up to [55720].
Props utsav72640, rajinsharwar, costdev, mukesh27, peterwilsoncc, audrasjb, SergeyBiryukov.
See #58940.
git-svn-id: https://develop.svn.wordpress.org/trunk@56341 602fd350-edb4-49c9-b593-d223f7449a82
Includes bug fixes for footnotes, patterns, command palette, top toolbar and other small regressions.
Props andrewserong, spacedmonkey.
See #58926.
git-svn-id: https://develop.svn.wordpress.org/trunk@56332 602fd350-edb4-49c9-b593-d223f7449a82
In this patch we're introducing support for the SPAN element, which is the first
in the class of "any other tag" in the "in body" insertion mode.
This patch introduces the mechanisms required to handle that class of tags but
only introduces SPAN to keep the change focused. With the tests and mechanisms
in place it will be possible to follow-up and add another limited set of tags.
It's important that this not use the default catch-all in the switch handling
`step_in_body` because that would catch tags that have specific rules in previous
case statements that aren't yet added. For example, we don't want to treat the
`TABLE` element as "any other tag".
Props dmsnell.
Fixes#58907.
git-svn-id: https://develop.svn.wordpress.org/trunk@56331 602fd350-edb4-49c9-b593-d223f7449a82
Excludes parent template when a child template is defined during template retrieval.
Props oandregal, mukesh27, flixos90, bgardner.
See #57756.
git-svn-id: https://develop.svn.wordpress.org/trunk@56329 602fd350-edb4-49c9-b593-d223f7449a82
Includes bug fixes for patterns, command palette and several minor regressions.
Props ramonopoly.
See #58926.
git-svn-id: https://develop.svn.wordpress.org/trunk@56320 602fd350-edb4-49c9-b593-d223f7449a82
This reverts [56316] as it needs to be fixed by updating npm packages.
Unprops audrasjb.
Props swissspidy.
See #58920.
git-svn-id: https://develop.svn.wordpress.org/trunk@56317 602fd350-edb4-49c9-b593-d223f7449a82
In coordination with the release of 6.3, a new version of each bundled theme will also be released. This bumps the version of each theme to the following:
- Twenty Ten: 3.9
- Twenty Eleven: 4.4
- Twenty Twelve: 4.0
- Twenty Thirteen: 3.9
- Twenty Fourteen: 3.7
- Twenty Fifteen: 3.5
- Twenty Sixteen: 3.0
- Twenty Seventeen: 3.3
- Twenty Nineteen: 2.6
- Twenty Twenty: 2.3
- Twenty Twenty-One: 1.9
- Twenty Twenty-Two: 1.5
- Twenty Twenty-Three: 1.2
Props mukesh27, hareesh-pillai, audrasjb, jakariaistauk, kafleg, sabernhardt, spacedmonkey.
Fixes#57857.
git-svn-id: https://develop.svn.wordpress.org/trunk@56315 602fd350-edb4-49c9-b593-d223f7449a82
This adds `optional` to the list of valid `font-display` values that can be used when validating webfonts.
Props merel1988, asafm7, mukesh27.
Fixes#58454.
git-svn-id: https://develop.svn.wordpress.org/trunk@56314 602fd350-edb4-49c9-b593-d223f7449a82
This sets the following environment variables when running automated performance tests to avoid side effects that can skew performance data when the default development environment variables are used:
* `SAVEQUERIES`: `false`
* `SCRIPT_DEBUG`: `false`
* `WP_DEBUG`: `false`
* `WP_DEVELOPMENT_MODE`: `''`
Props rajinsharwar, desrosj, mukesh27, joemcgill.
Fixes#58825.
git-svn-id: https://develop.svn.wordpress.org/trunk@56313 602fd350-edb4-49c9-b593-d223f7449a82
This commit updates the link URL to send contributors to an orientation tool for a short survey on what team they may be interested in joining. This coincides with the Get Involved tab.
Follow-up to [17877], [26354], [35898], [43032], [56220].
Props courane01, audrasjb.
See #23348.
git-svn-id: https://develop.svn.wordpress.org/trunk@56311 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds a `wp-admin/network/contribute.php` file to allow the Get Involved tab to work on Network Admin.
Props courane01, ryelle, audrasjb.
See #23348.
git-svn-id: https://develop.svn.wordpress.org/trunk@56309 602fd350-edb4-49c9-b593-d223f7449a82
This restores the GitHub Actions job responsible for automatically retrying a failed workflow once within the E2E testing workflow.
[56198] disabled Slack notifications for this workflow because of the increased number of timeout errors occurring after recent changes until they could be further investigated. Even though the signal-to-noise ration was way too high, there’s still benefit in retrying the workflow once to see if the timeout can be resolved without human intervention. The one retry attempt will not result in any Slack notifications.
Follow up to [56198].
See #58779.
git-svn-id: https://develop.svn.wordpress.org/trunk@56308 602fd350-edb4-49c9-b593-d223f7449a82
Previously, Site Editor client-side routing started using only the path query argument for loading non-editor views. The router removed the `postType` query
argument, which caused an error message to be displayed when the template parts list page was reloaded.
This changeset fixes the issue as it was affecting hybrid themes.
Props Mamaduka, isabel_brison, ramonopoly.
Fixes#58889.
git-svn-id: https://develop.svn.wordpress.org/trunk@56302 602fd350-edb4-49c9-b593-d223f7449a82
This adds a missing `public` keyword for `WP_HTML_Tag_Processor::get_attribute_names_with_prefix()`.
Follow-up to [55203].
Props jrf.
See #58831.
git-svn-id: https://develop.svn.wordpress.org/trunk@56301 602fd350-edb4-49c9-b593-d223f7449a82
This changeset replaces `add_action( 'enqueue_block_editor_assets' )`, with `add_action( 'enqueue_block_assets' )`, in class `Twenty_Twenty_One_Dark_Mode` and class
`Twenty_Twenty_One_Custom_Colors`. This fixes an issue when activating dark mode in Twenty Twenty-One, where dark mode was not enabled in the block editor.
Props poena, mikinc860, huzaifaalmesbah, hasanuzzamanshamim, Ankit-K-Gupta.
Fixes#58835.
git-svn-id: https://develop.svn.wordpress.org/trunk@56300 602fd350-edb4-49c9-b593-d223f7449a82
In order to comply with the test class naming scheme set forth in #56846, rename the test classes covering the HTML API by changing the `wp` infix to `Wp`.
Props dmsnell, costdev.
Fixes#58899. See #56846.
git-svn-id: https://develop.svn.wordpress.org/trunk@56299 602fd350-edb4-49c9-b593-d223f7449a82
Adds raw title property when loading the navigation fallback with an embed context.
Props ramonopoly, get_dave, scruffian, mukesh27, audrasjb.
Fixes#58557.
git-svn-id: https://develop.svn.wordpress.org/trunk@56296 602fd350-edb4-49c9-b593-d223f7449a82
Update the headers, icons, and avatar style to match the designs. Fix the version strings on embedded images. Remove the tagline on main About page. Update "ctrl" to the correct capitalization, "Ctrl".
Follow-up to [56263].
Props richtabor, markoserb, audrasjb, nekojonez.
See #58067.
git-svn-id: https://develop.svn.wordpress.org/trunk@56292 602fd350-edb4-49c9-b593-d223f7449a82
Update the background image and styles for the Welcome Panel. This iteration does not use different colors on the admin color schemes, so the CSS for that has been removed. This also adds back in a working "Edit styles" link, which was removed in 6.2 because the link was broken.
Props richtabor, markoserb.
Fixes#58545.
git-svn-id: https://develop.svn.wordpress.org/trunk@56291 602fd350-edb4-49c9-b593-d223f7449a82
This changeset improves the consistency of the use of "e.g." in template descriptions.
Props jordesign, audrasjb, joedolson.
Fixes#58879.
git-svn-id: https://develop.svn.wordpress.org/trunk@56287 602fd350-edb4-49c9-b593-d223f7449a82