Commit Graph

42987 Commits

Author SHA1 Message Date
desrosj
6daeadb85e Twenty Twenty-One: Correct @since inline documentation tags.
Previously, `1.0.0` was used for the version. This is inconsistent with the versioning used in the other default themes, which use use X.X and not X.X.X.

This change corrects all `1.0.0` occurrences to `1.0`, and adds the additional context of `Twenty Twenty-One` to avoid confusion with `WordPress 1.0`.

Props SergeyBiryukov, poena.
Fixes #51958.
Built from https://develop.svn.wordpress.org/trunk@49826


git-svn-id: http://core.svn.wordpress.org/trunk@49545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-17 14:57:07 +00:00
desrosj
66d46430a7 Twenty Twenty-One: Make text within code blocks readable in Dark Mode.
This change ensures that the primary text color specific to Dark Mode is used instead of the one specified for normal mode. The latter is not legible in Dark Mode.

Props slaFFik, poena, mukesh27, justinahinon.
Fixes #51985.
Built from https://develop.svn.wordpress.org/trunk@49825


git-svn-id: http://core.svn.wordpress.org/trunk@49544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-17 14:22:05 +00:00
desrosj
b7a899e8aa Twenty Twenty-One: Prevent <iframe> embeds from being too narrow.
This fixes an issue where `<iframe>` embeds were being pushed to the side of the screen and compressed to the point of being unusable.

Props helen, mukesh27, poena, thorlentz.
Fixes #52004.
Built from https://develop.svn.wordpress.org/trunk@49823


git-svn-id: http://core.svn.wordpress.org/trunk@49542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-17 14:05:05 +00:00
desrosj
3dce40e526 Build/Test Tools: Save changes resulting from npm install.
See #51801.
Built from https://develop.svn.wordpress.org/trunk@49822


git-svn-id: http://core.svn.wordpress.org/trunk@49541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-17 13:59:08 +00:00
Felix Arntz
bb234abee7 Media: Enable lazy-loading of iframes by adding the loading="lazy" attribute to iframe tags on the front-end.
* Expands the capabilities of `wp_filter_content_tags()` to add the attribute to iframe tags if enabled.
* Modifies the default behavior of `wp_lazy_loading_enabled()` so that it returns `true` for `iframe` tags.
* Introduces a `wp_iframe_tag_add_loading_attr()` function.
* Introduces a `wp_iframe_tag_add_loading_attr` filter.

Like for images, the attribute is only added to iframes which have both `width` and `height` specified (see related #50367).

Props azaozz, flixos90, westonruter.
Fixes #50756.

Built from https://develop.svn.wordpress.org/trunk@49808


git-svn-id: http://core.svn.wordpress.org/trunk@49531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-16 21:19:07 +00:00
Andrew Ozz
71ae342050 Editor: Fix improper triggering of the "Are you sure" prompt when navigating away from the old, "classic" Edit Post screen and there are no changes. Was triggered when there is an instance of TinyMCE in the Excerpt postbox.
Props rodrigosprimo, jonathanstegall, kevin940726, azaozz.
Fixes #52038.
Built from https://develop.svn.wordpress.org/trunk@49807


git-svn-id: http://core.svn.wordpress.org/trunk@49530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-16 15:25:09 +00:00
iandunn
2ebc78cbf4 Feed: Replace join() with implode() for safety.
Canonical functions should be used instead of aliases, because aliases can be deprecated or removed withough much notice. See r49193.

Props SergeyBiryukov.
See #51056.

Built from https://develop.svn.wordpress.org/trunk@49805


git-svn-id: http://core.svn.wordpress.org/trunk@49528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-16 14:05:07 +00:00
Andrew Ozz
734f9bd9e2 Media: Fix the template for the "Align" and "Link To" fields in the media modal when inserting an image from URL.
Props noisysocks, mukesh27.
Fixes #52065.
Built from https://develop.svn.wordpress.org/trunk@49804


git-svn-id: http://core.svn.wordpress.org/trunk@49527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-16 12:45:11 +00:00
iandunn
d544fc7cb4 Feed: Merge multiple header values to avoid fatal error.
When SimplePie parses HTTP headers, it combines multiple values for the same header into a comma-separated string. `WP_SimplePie_File` overrides the parsing, but was leaving them as an array instead.

That lead to a fatal error in PHP 8, because other parts of the codebase ended up passing an array to a function that expected a string.

Props david.binda, litemotiv, inc2734, NicolasKulka, hellofromTonya, mbabker, skithund, SergeyBiryukov, desrosj, timothyblynjacobs.
Fixes #51056. See #51956.


Built from https://develop.svn.wordpress.org/trunk@49803


git-svn-id: http://core.svn.wordpress.org/trunk@49526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-16 00:51:05 +00:00
John Blackbourn
ec900ebb43 Docs: Correct the documentation for the map_meta_cap() function and its filter.
See #51800

Built from https://develop.svn.wordpress.org/trunk@49802


git-svn-id: http://core.svn.wordpress.org/trunk@49525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-15 22:18:07 +00:00
Sergey Biryukov
b8f6d41a2c Twenty Twenty-One: Fix typos in some inline comments.
Props manzurahammed, mukesh27.
Fixes #52071.
Built from https://develop.svn.wordpress.org/trunk@49801


git-svn-id: http://core.svn.wordpress.org/trunk@49524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-15 13:28:06 +00:00
ryelle
da72be5227 Twenty Twenty-One: Bring back PostCSS config.
Twenty Twenty-One uses PostCSS to convert the custom properties for Internet Explorer. Without a config file, the postcss command does nothing, causing issues in IE. This brings back the config from GitHub, which replaces all custom properties with the default values.

Props t-p, poena.
Fixes #52040.


Built from https://develop.svn.wordpress.org/trunk@49800


git-svn-id: http://core.svn.wordpress.org/trunk@49523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-14 16:49:03 +00:00
Sergey Biryukov
71bbd2b166 Twenty Twenty-One: Correct the DocBlock for map-deep-set() Sass function.
Props mukesh27.
Fixes #52064.
Built from https://develop.svn.wordpress.org/trunk@49799


git-svn-id: http://core.svn.wordpress.org/trunk@49522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-14 15:22:09 +00:00
Sergey Biryukov
9494c5fbee Twenty Twenty-One: Use a more specific link for Dark Mode instructions.
Make both instances of the link translatable, for consistency.

Props engahmeds3ed, justinahinon.
Fixes #52010.
Built from https://develop.svn.wordpress.org/trunk@49798


git-svn-id: http://core.svn.wordpress.org/trunk@49521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-13 18:40:06 +00:00
desrosj
3ed22735d3 Build/Test Tools: Allow code coverage reports to be generated when running tests as a multisite.
This adds the information needed to generate a code coverage report to the multisite ruleset.

Fixes #52034.
Built from https://develop.svn.wordpress.org/trunk@49797


git-svn-id: http://core.svn.wordpress.org/trunk@49520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-12 20:09:08 +00:00
desrosj
4d4ec9484c Build/Test Tools: Remove PHPUnit 3.6.x specific settings from the multisite configuration.
In PHPUnit 3.6.x, `exclude` and `file` paths were required to be relative to the checkout root. This changed in PHPUnit 4 when the path requirements were changed require them to be relative to the configuration file.

Since PHPUnit 3.6.x is only used to test on PHP 5.2 in older branches and is no longer supported, these can be safely removed from the configuration file.

See #51802.
Built from https://develop.svn.wordpress.org/trunk@49796


git-svn-id: http://core.svn.wordpress.org/trunk@49519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-12 18:08:02 +00:00
Sergey Biryukov
994167b76f Twenty Twenty-One: Fix typos in some inline comments.
Props tanvirul, mukesh27.
Fixes #52042.
Built from https://develop.svn.wordpress.org/trunk@49795


git-svn-id: http://core.svn.wordpress.org/trunk@49518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-12 15:03:06 +00:00
Sergey Biryukov
4ca3db8c90 Twenty Twenty-One: Correct version in file-header.scss.
Fixes #52044.
Built from https://develop.svn.wordpress.org/trunk@49794


git-svn-id: http://core.svn.wordpress.org/trunk@49517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-12 14:57:07 +00:00
ryelle
bba3a9d529 Twenty Nineteen: Add images for use in block patterns.
The block patterns were added in #51099, but the images were not included in the commit. This adds the images to the expected folder.

Props transl8or, mukesh27.
Fixes #51996.


Built from https://develop.svn.wordpress.org/trunk@49793


git-svn-id: http://core.svn.wordpress.org/trunk@49516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-11 16:55:03 +00:00
Sergey Biryukov
43bbbf1176 Docs: Document the usage of $wpdb global in WP_Query::get_posts() and ::set_found_posts().
Props jontyravi.
Fixes #52027.
Built from https://develop.svn.wordpress.org/trunk@49792


git-svn-id: http://core.svn.wordpress.org/trunk@49515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-11 16:53:10 +00:00
desrosj
e4066a9af8 Build/Test Tools: Update several NPM packages.
These were updated using `npm audit fix`.

See #51801.
Built from https://develop.svn.wordpress.org/trunk@49791


git-svn-id: http://core.svn.wordpress.org/trunk@49514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-11 14:05:07 +00:00
John Blackbourn
bf83c368fd Docs: Various docblock improvements.
See #51800

Built from https://develop.svn.wordpress.org/trunk@49790


git-svn-id: http://core.svn.wordpress.org/trunk@49513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 23:59:03 +00:00
John Blackbourn
42fcfa5b3d Docs: Various docblock corrections.
See #51800

Built from https://develop.svn.wordpress.org/trunk@49789


git-svn-id: http://core.svn.wordpress.org/trunk@49512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 23:53:07 +00:00
John Blackbourn
7e9060a0e4 Upgrade/Install: Remove a duplicate description for the upgrader_overwrote_package action.
See #51800, #9757

Built from https://develop.svn.wordpress.org/trunk@49788


git-svn-id: http://core.svn.wordpress.org/trunk@49511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 23:38:04 +00:00
John Blackbourn
1ead0719b7 Docs: Fix some docblock issues introduced in 5.6.
See #51800

Built from https://develop.svn.wordpress.org/trunk@49787


git-svn-id: http://core.svn.wordpress.org/trunk@49510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 23:27:06 +00:00
desrosj
2808e92c43 Build/Test Tools: Reestablish the codebase as a Git repo before reporting test results.
The test reporter uses the hidden `.svn` or `.git` directories to determine which changeset to send to WordPress.org along with the test report.

Because the GitHub Action workflow builds and prepares WordPress in a preceding job to share with each test job, the `.git` directory is missing (it is purposefully not included to limit artifact size).

This re-establishes the directory as a checkout of the `wordpress-develop` repository so that test results can be reported correctly.

See #50401.
Built from https://develop.svn.wordpress.org/trunk@49786


git-svn-id: http://core.svn.wordpress.org/trunk@49509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 19:19:06 +00:00
Sergey Biryukov
4a69dfa63a Docs: Fix typo in some DocBlocks.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@49785


git-svn-id: http://core.svn.wordpress.org/trunk@49508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 18:12:03 +00:00
desrosj
c0806cf29c Build/Test Tools: Inline documentation updates for the PHPUnit workflow.
See #50401.
Built from https://develop.svn.wordpress.org/trunk@49784


git-svn-id: http://core.svn.wordpress.org/trunk@49507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 15:30:04 +00:00
desrosj
66b75f9ad7 Build/Test Tools: Enable reporting of results to WordPress.org.
This configures reporting of the test results to the WordPress.org Host Test Results in the new GitHub Actions workflow for PHPUnit testing.

See https://make.wordpress.org/hosting/test-results/

Props mikeschroder, dd32.
See #50401.
Built from https://develop.svn.wordpress.org/trunk@49783


git-svn-id: http://core.svn.wordpress.org/trunk@49506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 14:20:08 +00:00
desrosj
fb4450a86f Build/Test Tools: Use NodeJS 14 in GitHub Action workflows.
14.x is the current LTS release, and is what `trunk` currently runs.

See #50401.
Built from https://develop.svn.wordpress.org/trunk@49782


git-svn-id: http://core.svn.wordpress.org/trunk@49505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-09 20:57:04 +00:00
desrosj
030b4bd1da Build/Test Tools: Disable GitHub Action workflow runs triggered on push for forks and mirrors.
In the current state, the workflows run regardless of the repository context. This results many needless workflow runs that waste resources.

Workflow runs for private repositories are not free (accounts have a finite allotment of minutes for private repositories). This becomes problematic in private repositories that also mirror the WordPress develop repository, as any workflow runs will draw from a user’s or organization’s allotted action minutes.

Without blanket disabling the workflow manually for all event triggers, or modifying the workflow files in the forked/mirrored repository, there is no way to tune when the workflows run.

This change introduces a conditional statement into all GitHub Action workflows that prevents them from running on forked/mirrored repositories that are not `wordpress-develop`, except when a pull request is being submitted to that repository.

The exception to this is the Welcome workflow that posts a helpful message to first time contributors to `wordpress-develop`. This message is specific to this repository, so should only run when a PR is submitted to that repository.

See #50401.
Built from https://develop.svn.wordpress.org/trunk@49781


git-svn-id: http://core.svn.wordpress.org/trunk@49504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-09 20:06:04 +00:00
desrosj
e9feb6fca3 Build/Test Tools: Update package-lock.json file with several package updates.
These updates result from running `npm install`.

Also, update the version of `grunt-patch-wordpress` in the lock file from `3.0.0` to `3.0.1`.

See #51801.
Built from https://develop.svn.wordpress.org/trunk@49780


git-svn-id: http://core.svn.wordpress.org/trunk@49503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-09 19:33:06 +00:00
desrosj
2e90ec8789 Build/Test Tools: Remove the Appveyor configuration file.
Appveyor was added to Core in [44594] to ensure that NPM and the WordPress build tools continue to work correctly on Windows systems as changes are made. Using an additional service for this was required at the time, TravisCI did not support testing on Windows.

[49162] introduced a GitHub Action workflow that performed the same testing. Since all automated testing is moving to GitHub Actions, using Appveyor is no longer necessary, and it’s preferable to have all automated testing in one location as much as possible.

Props ayeshrajans.
Fixes #51968.
Built from https://develop.svn.wordpress.org/trunk@49779


git-svn-id: http://core.svn.wordpress.org/trunk@49502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-09 13:35:05 +00:00
Helen Hou-Sandí
e516134d10 Update $_old_files for 5.6.
See #39943.

Built from https://develop.svn.wordpress.org/trunk@49774


git-svn-id: http://core.svn.wordpress.org/trunk@49497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-08 21:50:07 +00:00
TimothyBlynJacobs
a9244a2912 App Passwords: Ensure redirection description is shown on mobile devices.
Props #core.
Fixes #51970.

Built from https://develop.svn.wordpress.org/trunk@49772


git-svn-id: http://core.svn.wordpress.org/trunk@49495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-08 20:28:04 +00:00
ryelle
aaf90076c5 Help/About: Use CDN URLs for About page images.
See #51415.


Built from https://develop.svn.wordpress.org/trunk@49770


git-svn-id: http://core.svn.wordpress.org/trunk@49493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-08 17:02:06 +00:00
Sergey Biryukov
52d2b07600 Docs: Fix typo in references to WP_Error in some DocBlocks.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@49769


git-svn-id: http://core.svn.wordpress.org/trunk@49492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-08 11:51:05 +00:00
TimothyBlynJacobs
efdba220e6 App Passwords: Store the "in use" option in the main network options.
Whether App Passwords are being used is a global featurel, not a per-network feature. This fixes issues on Multi Network installs if App Passwords are used on a different network from where they were created.

Props spacedmonkey.
Fixes #51939.
See [49752].

Built from https://develop.svn.wordpress.org/trunk@49764


git-svn-id: http://core.svn.wordpress.org/trunk@49487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-07 15:59:04 +00:00
Sergey Biryukov
29e882c177 Bundled Themes: Bump theme versions ahead of WordPress 5.6.
The following theme versions will be released in coordination with WordPress 5.6:

* Twenty Ten: 3.2
* Twenty Eleven: 3.6
* Twenty Twelve: 3.3
* Twenty Thirteen: 3.2
* Twenty Fourteen: 3.0
* Twenty Fifteen: 2.8
* Twenty Sixteen: 2.3
* Twenty Seventeen: 2.5
* Twenty Nineteen: 1.8
* Twenty Twenty: 1.6
* Twenty Twenty-One: 1.0

Props peterwilsoncc, hareesh-pillai, dkarfa, sabernhardt, poena, aristath, SergeyBiryukov.
Fixes #51919.
Built from https://develop.svn.wordpress.org/trunk@49763


git-svn-id: http://core.svn.wordpress.org/trunk@49486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-07 15:55:05 +00:00
Sergey Biryukov
12ce5683ab Twenty Twenty-One: Use esc_url() for the WordPress.org link in footer.php.
Props mukesh27, poena.
Fixes #51954.
Built from https://develop.svn.wordpress.org/trunk@49762


git-svn-id: http://core.svn.wordpress.org/trunk@49485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-07 14:17:04 +00:00
Sergey Biryukov
2095631176 Twenty Twenty-One: Use consistent HTML comments after closing HTML tags.
Follow-up to [45209] for other bundled themes.

Props arcangelini, audrasjb.
Fixes #51950.
Built from https://develop.svn.wordpress.org/trunk@49761


git-svn-id: http://core.svn.wordpress.org/trunk@49484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-07 14:07:06 +00:00
Sergey Biryukov
a4730c14ba Twenty Twenty-One: Fix the nesting of the main element.
The `main` element must not appear as a descendant of the `section` element. Correct markup is the first requirement to make user agents and assistive technologies work properly.

Changes the `<section>` element that was wrapping the `<main>` element to a `<div>`.

Follow-up to [45942] for Twenty Nineteen.

Props albertomake, poena.
Fixes #51944.
}}}
Built from https://develop.svn.wordpress.org/trunk@49759


git-svn-id: http://core.svn.wordpress.org/trunk@49482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-06 16:22:06 +00:00
Peter Wilson
675620a844 Docs, Tests: Correctly capitalize JavaScript.
Correct Javascript to JavaScript within Wordpress core ;)

See #51800, #51802.


Built from https://develop.svn.wordpress.org/trunk@49758


git-svn-id: http://core.svn.wordpress.org/trunk@49481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-06 02:21:07 +00:00
Sergey Biryukov
90510b8762 Tests: Correct @ticket references in some test files.
See #51802.
Built from https://develop.svn.wordpress.org/trunk@49757


git-svn-id: http://core.svn.wordpress.org/trunk@49480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-05 15:51:10 +00:00
TimothyBlynJacobs
aac98aae97 App Passwords: Prevent conflicts when Basic Auth is already used by the site.
Application Passwords uses Basic Authentication to transfer authentication details. If the site is already using Basic Auth, for instance to implement a private staging environment, then the REST API will treat this as an authentication attempt and would end up generating an error for any REST API request.

Now, Application Password authentication will only be attempted if Application Passwords is in use by a site. This is flagged by setting an option whenever an Application Password is created. An upgrade routine is added to set this option if any App Passwords already exist.

Lastly, creating an Application Password will be prevented if the site appears to already be using Basic Authentication.

Props chexwarrior, georgestephanis, adamsilverstein, helen, Clorith, marybaum, TimothyBlynJacobs.
Fixes #51939.


Built from https://develop.svn.wordpress.org/trunk@49752


git-svn-id: http://core.svn.wordpress.org/trunk@49475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-04 21:44:07 +00:00
iandunn
77236320d3 Media: Return WP_Error when cropping with bad input to avoid fatal.
This avoids an error on PHP 8 caused by calling `wp_imagecreatetruecolor()` with inputs that aren't numeric, or are less than 0.

Props hellofromtonya, Boniu91, metalandcoffee, SergeyBiryukov.
Fixes #51937.

Built from https://develop.svn.wordpress.org/trunk@49751


git-svn-id: http://core.svn.wordpress.org/trunk@49474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-04 21:41:06 +00:00
Sergey Biryukov
e7b601f7c5 Database: Check the correct value for displaying the "Successfully repaired table" or "Failed to repair" messages on Database Repair screen.
Additionally, rename the variables holding the results of `ANALYZE TABLE` and `OPTIMIZE TABLE` requests, for clarity.

Props mehrshaddarzi.
Fixes #51932.
Built from https://develop.svn.wordpress.org/trunk@49750


git-svn-id: http://core.svn.wordpress.org/trunk@49473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-04 15:50:12 +00:00
TimothyBlynJacobs
692c6498e9 App Passwords: Ensure the Created At and Last Used dates are properly translated.
The `date_i18n` function is now used when formatting the dates in PHP instead of `gmdate` which doesn't handle localization properly.

Additionally, we now use a translation to get the date format to use instead of pulling from the `date_format` option which is only supposed to affect the front-end.

Lastly, when passing the date format to the Backbone JS template, we now use `wp_json_encode()` to format the value for JavaScript. This ensures that backslashes are properly preserved which are used by some locales to escape date formatting control characters.

Props pedromendonca, TimothyBlynJacobs, ocean90, hellofromtonya, SergeyBiryukov, antpb.
Fixes #51918.
See [35811].

Built from https://develop.svn.wordpress.org/trunk@49746


git-svn-id: http://core.svn.wordpress.org/trunk@49469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-03 21:06:08 +00:00
iandunn
4de6175227 Multisite: Cache absolute dirsize paths to avoid PHP 8 fatal.
r49212 greatly improved the performance of `get_dirsize()`, but also changed the structure of the data stored in the `dirsize_cache` transient. It stored relative paths instead of absolute ones, and also removed the unnecessary `size` array.

That difference in data structures led to a fatal error in the following environment:

* PHP 8
* Multisite
* A custom `WP_CONTENT_DIR` which is not a child of WP's `ABSPATH` folder (e.g., [https://roots.io/bedrock/ Bedrock])
* The `upload_space_check_disabled` option set to `0`

After upgrading to WP 5.6, the `dirsize_cache` transient still had data in the old format. When `wp-admin.php/index.php` was visited, `get_space_used()` received an `array` instead of an `int`, and tried to divide it by another `int`. PHP 7 would silently cast the arguments to match data types, but [https://wiki.php.net/rfc/arithmetic_operator_type_checks PHP 8 throws a fatal error]: 

`Uncaught TypeError: Unsupported operand types: array / int`

`recurse_dirsize()` was using `ABSPATH` to convert the absolute paths to relative ones, but some upload locations are not located under `ABSPATH`. In those cases, `$directory` and `$cache_path` were identical, and that triggered the early return of the old `array`, instead of the expected `int`. 

In order to avoid that, this commit restores the absolute paths, but without the `size` array. It also adds a type check when returning cached values. Using absolute paths without `size` has the result of overwriting the old data, so that it matches the new format. The type check and upgrade routine are additional safety measures.

Props peterwilsoncc, janthiel, helen, hellofromtonya, francina, pbiron.
Fixes #51913. See #19879.


Built from https://develop.svn.wordpress.org/trunk@49744


git-svn-id: http://core.svn.wordpress.org/trunk@49467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-03 20:39:02 +00:00
Sergey Biryukov
203b48f281 Upgrade/Install: Update sodium_compat to v1.14.0.
This includes improved PHP 8 support and more inclusive language.

A full list of changes in this update can be found on GitHub:
https://github.com/paragonie/sodium_compat/compare/v1.13.0...v1.14.0

Follow-up to [48121], [49056], [49057].

Props jrf.
Fixes #51925.
Built from https://develop.svn.wordpress.org/trunk@49741


git-svn-id: http://core.svn.wordpress.org/trunk@49464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-03 17:41:07 +00:00