diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml
index 9825166f0fb38..15d3c76f7da89 100644
--- a/.github/actionlint.yaml
+++ b/.github/actionlint.yaml
@@ -10,3 +10,4 @@ paths:
.github/workflows/**/*.yml:
ignore:
- 'specifying action "\$/[^"]+" in invalid format because ref is missing'
+ - 'reusable workflow call "\$/[^"]+" at "uses" is not following the format'
diff --git a/.github/workflows/file-type-check.yml b/.github/workflows/file-type-check.yml
new file mode 100644
index 0000000000000..e2773384a8009
--- /dev/null
+++ b/.github/workflows/file-type-check.yml
@@ -0,0 +1,182 @@
+name: File Type Check
+
+on:
+ push:
+ branches:
+ - trunk
+ - '6.[8-9]'
+ - '[7-9].[0-9]'
+ paths:
+ # Inward check: files added to CSS/JS directories.
+ - 'src/wp-includes/css/**'
+ - 'src/wp-includes/js/**'
+ - 'src/wp-admin/css/**'
+ - 'src/wp-admin/js/**'
+ # Outward check: CSS/JS files placed outside designated directories.
+ - 'src/wp-includes/**.css'
+ - 'src/wp-includes/**.js'
+ - 'src/wp-admin/**.css'
+ - 'src/wp-admin/**.js'
+ # Confirm any changes to the workflow file itself.
+ - '.github/workflows/file-type-check.yml'
+ pull_request:
+ branches:
+ - trunk
+ - '6.[8-9]'
+ - '[7-9].[0-9]'
+ paths:
+ - 'src/wp-includes/css/**'
+ - 'src/wp-includes/js/**'
+ - 'src/wp-admin/css/**'
+ - 'src/wp-admin/js/**'
+ - 'src/wp-includes/**.css'
+ - 'src/wp-includes/**.js'
+ - 'src/wp-admin/**.css'
+ - 'src/wp-admin/**.js'
+ - '.github/workflows/file-type-check.yml'
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
+ cancel-in-progress: true
+
+permissions: {}
+
+jobs:
+ # Verifies that CSS and JS files live in the directories intended for them.
+ #
+ # The JS sources in src/js/ are out of scope. The build system decides where
+ # those are placed, so only its output is checked.
+ check-file-types:
+ name: Verify file types in CSS/JS directories
+ runs-on: ubuntu-26.04
+ permissions:
+ contents: read
+ if: |
+ github.repository == 'WordPress/wordpress-develop' || (
+ github.event_name == 'pull_request' && (
+ ! github.event.repository.private ||
+ ! github.event.pull_request.draft ||
+ contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
+ )
+ )
+ timeout-minutes: 5
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
+ with:
+ show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
+ persist-credentials: false
+
+ - name: Check for misplaced CSS and JS files
+ run: |
+ # Git does the filtering, so no path is ever matched as text. Shell
+ # patterns break on names holding a tab, a newline or a quote: Git
+ # C-quotes those, and core.quotePath=false does not stop it.
+ #
+ # Each check is a bare assignment, so `set -e` sees a failure from Git.
+ #
+ # Every exclude starts with src/, the directory the positive pathspecs share.
+ # git ls-files strips that shared directory from every pathspec, excludes
+ # included, without checking that it is there. An exclude such as *.js is
+ # then cut down to a pattern that can match every file.
+ #
+ # Only tracked files are checked. The PHP that Gutenberg generates
+ # into css/dist and js/dist is untracked, so it never appears here.
+ # Whether it should be tracked, moved, or not copied at all is still
+ # open in #65278. If it becomes tracked, this check will flag it.
+
+ # Git exits 0 when a pathspec matches nothing.
+ if [ -z "$( git ls-files -- src/wp-includes src/wp-admin )" ]; then
+ echo "::error::No tracked files found under src/wp-includes or src/wp-admin."
+ exit 1
+ fi
+
+ # The SCSS sources for the admin color schemes are the only tracked
+ # non-CSS files in these directories.
+ inward_css=$( git ls-files -- src/wp-includes/css src/wp-admin/css \
+ ':(exclude,glob)src/wp-includes/css/**/*.css' \
+ ':(exclude,glob)src/wp-admin/css/**/*.css' \
+ ':(exclude,glob)src/wp-admin/css/colors/**/*.scss' )
+
+ # Both directories are gitignored in full, so this only catches a file
+ # committed with `git add -f`.
+ inward_js=$( git ls-files -- src/wp-includes/js src/wp-admin/js \
+ ':(exclude,glob)src/wp-includes/js/**/*.js' \
+ ':(exclude,glob)src/wp-admin/js/**/*.js' )
+
+ # src/wp-includes/build/ is tracked, not gitignored: it holds the
+ # generated routes and pages.
+ outward=$( git ls-files -- \
+ ':(glob)src/wp-includes/**/*.css' ':(glob)src/wp-includes/**/*.js' \
+ ':(glob)src/wp-admin/**/*.css' ':(glob)src/wp-admin/**/*.js' \
+ ':(exclude,glob)src/wp-includes/css/**' \
+ ':(exclude,glob)src/wp-includes/js/**' \
+ ':(exclude,glob)src/wp-admin/css/**' \
+ ':(exclude,glob)src/wp-admin/js/**' \
+ ':(exclude,glob)src/wp-includes/build/**' )
+
+ violations=$( printf '%s\n%s\n%s' "$inward_css" "$inward_js" "$outward" | grep -v '^$' || true )
+
+ if [ -n "$violations" ]; then
+ echo "::error::Misplaced files found."
+ echo
+ echo "$violations"
+ echo
+ echo "CSS directories should contain only .css files and JS directories only .js files."
+ echo ".css and .js files belong in those directories, not elsewhere in wp-includes/ or wp-admin/."
+ echo "If a file is a legitimate exception, update .github/workflows/file-type-check.yml."
+ exit 1
+ fi
+
+ echo "All tracked CSS and JS files are correctly placed."
+
+ slack-notifications:
+ name: Slack Notifications
+ uses: ./.github/workflows/slack-notifications.yml
+ permissions:
+ actions: read
+ contents: read
+ needs: [ check-file-types ]
+ if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
+ with:
+ calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
+ secrets:
+ SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
+ SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
+ SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
+ SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
+
+ failed-workflow:
+ name: Failed workflow tasks
+ runs-on: ubuntu-26.04
+ permissions:
+ actions: write
+ needs: [ check-file-types, slack-notifications ]
+ if: |
+ always() &&
+ github.repository == 'WordPress/wordpress-develop' &&
+ github.event_name != 'pull_request' &&
+ github.run_attempt < 2 &&
+ (
+ contains( needs.*.result, 'cancelled' ) ||
+ contains( needs.*.result, 'failure' )
+ )
+
+ steps:
+ - name: Dispatch workflow run
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ with:
+ retries: 2
+ retry-exempt-status-codes: 418
+ script: |
+ github.rest.actions.createWorkflowDispatch({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ workflow_id: 'failed-workflow.yml',
+ ref: 'trunk',
+ inputs: {
+ run_id: `${context.runId}`,
+ }
+ });
diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml
index 4e1af59a308fd..eb238338b3e87 100644
--- a/.github/workflows/install-testing.yml
+++ b/.github/workflows/install-testing.yml
@@ -18,6 +18,7 @@ on:
- '.github/workflows/install-testing.yml'
- '.version-support-*.json'
- '.github/workflows/reusable-support-json-reader-v1.yml'
+ - '.github/workflows/reusable-download-wordpress-release.yml'
pull_request:
# Always test the workflow when changes are suggested.
paths:
@@ -27,6 +28,7 @@ on:
- '.version-support-*.json'
- '.github/workflows/install-testing.yml'
- '.github/workflows/reusable-support-json-reader-v1.yml'
+ - '.github/workflows/reusable-download-wordpress-release.yml'
schedule:
- cron: '0 0 * * 1'
@@ -59,6 +61,16 @@ jobs:
with:
wp-version: ${{ inputs.wp-version }}
+ # Downloads a release zip once for every matrix job, waiting until WordPress.org serves it.
+ download-wordpress:
+ name: Download WordPress
+ uses: $/.github/workflows/reusable-download-wordpress-release.yml
+ permissions:
+ contents: read
+ if: ${{ github.repository == 'WordPress/wordpress-develop' }}
+ with:
+ version: ${{ inputs.wp-version || 'nightly' }}
+
# Test the WordPress installation process through WP-CLI.
#
# Performs the following steps:
@@ -74,7 +86,7 @@ jobs:
runs-on: ${{ matrix.os }}
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
timeout-minutes: 15
- needs: [ build-test-matrix ]
+ needs: [ build-test-matrix, download-wordpress ]
env:
WP_ADMIN_USER: admin
@@ -147,9 +159,24 @@ jobs:
with:
version: ${{ contains( fromJSON('["5.4", "5.5"]'), matrix.php ) && '2.4.0' || contains( fromJSON('["5.6", "7.0", "7.1"]'), matrix.php ) && '2.12.0' || 'latest' }}
+ - name: Download the WordPress release artifact
+ if: ${{ needs.download-wordpress.outputs.artifact != '' }}
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ with:
+ name: ${{ needs.download-wordpress.outputs.artifact }}
+ path: ${{ runner.temp }}
+
+ # WP-CLI 2.4.0 cannot install from a local zip, so unzip it.
+ - name: Extract WordPress
+ if: ${{ needs.download-wordpress.outputs.artifact != '' }}
+ run: |
+ unzip -q "${RUNNER_TEMP}/wordpress.zip" -d "${RUNNER_TEMP}"
+ mv "${RUNNER_TEMP}"/wordpress/* .
+
# WP-CLI 2.x extracts tarballs with PharData, which truncates paths longer than 100 characters.
# Zip archives are not affected, so download the zip for every version.
- name: Download WordPress
+ if: ${{ needs.download-wordpress.outputs.artifact == '' }}
# WP-CLI requests WordPress from WordPress.org once, so a network error fails the job.
# It extracts only after a complete download, so a retry starts from an empty directory.
uses: $/.github/actions/run-with-retry
@@ -187,7 +214,7 @@ jobs:
permissions:
actions: read
contents: read
- needs: [ install-tests-mysql ]
+ needs: [ download-wordpress, install-tests-mysql ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
diff --git a/.github/workflows/phpstan-pull-request-comments.yml b/.github/workflows/phpstan-pull-request-comments.yml
index d1c38cc83fd10..170d770cd880b 100644
--- a/.github/workflows/phpstan-pull-request-comments.yml
+++ b/.github/workflows/phpstan-pull-request-comments.yml
@@ -57,6 +57,20 @@ jobs:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
+ # The results of the analysis holding selected paths to a stricter rule level. A pull request whose branch does
+ # not have that analysis yet uploads none, which is fine. Whether they were expected is decided from the results
+ # above.
+ - name: Download the results of the strict analysis
+ id: download-strict
+ if: ${{ steps.download.outcome == 'success' }}
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ continue-on-error: true
+ with:
+ name: phpstan-results-strict
+ path: ${{ runner.temp }}/phpstan-results-strict
+ run-id: ${{ github.event.workflow_run.id }}
+ github-token: ${{ github.token }}
+
- name: Create, update, or resolve the PHPStan comment
if: ${{ steps.download.outcome == 'success' }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
@@ -74,7 +88,7 @@ jobs:
// anything at all. They are therefore checked for shape, and only accepted for the pull request whose
// current head is the commit that the run analyzed. That also discards the results of a run that was
// overtaken by a newer push.
- const results = JSON.parse( fs.readFileSync( `${ process.env.RUNNER_TEMP }/phpstan-results/results.json`, 'utf8' ) );
+ const results = JSON.parse( fs.readFileSync( `${ process.env.RUNNER_TEMP }/phpstan-results/results.json`, { encoding: 'utf8' } ) );
const issue_number = results.pull_request;
if ( ! Number.isSafeInteger( issue_number ) || issue_number <= 0 || ! Array.isArray( results.errors ) ) {
core.setFailed( 'The analysis results are malformed.' );
@@ -93,12 +107,62 @@ jobs:
const asString = ( value ) => ( typeof value === 'string' ? value : null );
const asSha = ( value ) => ( typeof value === 'string' && /^[0-9a-f]{40}$/.test( value ) ? value : null );
+ // A rule level is a number, or `max`. Results from a branch that does not report the level have none.
+ const asLevel = ( value ) => ( ( Number.isSafeInteger( value ) && value >= 0 ) || value === 'max' ? value : null );
const normalize = ( error ) => ( {
file: asString( error.file ),
line: Number.isSafeInteger( error.line ) && error.line > 0 ? error.line : null,
message: ( asString( error.message ) ?? '' ).slice( 0, 1000 ),
identifier: /^[A-Za-z0-9.]+$/.test( error.identifier ) ? error.identifier : null,
ignorable: error.ignorable === true,
+ // The analysis that reported the error, and the rule level it analyzed at. Neither is reported per error:
+ // they are those of the results the error was read from, and are kept in the history from there.
+ analysis: error.analysis === 'strict' ? 'strict' : 'default',
+ level: asLevel( error.level ),
+ } );
+
+ // The paths held to a stricter rule level are analyzed a second time, and that analysis uploads its results
+ // separately. The results above list the analyses the run made, and when the strict one is among them but
+ // its results are missing, the comment is left as it is: every error that only analysis reported would
+ // otherwise be shown as resolved. A run from a branch that does not have that analysis yet lists none, and
+ // has only these results.
+ const expectsStrict = Array.isArray( results.analyses ) && results.analyses.includes( 'strict' );
+ let strictErrors = [];
+ let strictLevel = null;
+ let strictChangedInBase = [];
+ if ( expectsStrict ) {
+ let strictResults = null;
+ try {
+ strictResults = JSON.parse( fs.readFileSync( `${ process.env.RUNNER_TEMP }/phpstan-results-strict/results.json`, { encoding: 'utf8' } ) );
+ } catch ( error ) {
+ core.info( `The results of the strict analysis are missing, so the comment is left as it is: ${ error.message }` );
+ return;
+ }
+ if ( strictResults?.pull_request !== issue_number || ! Array.isArray( strictResults.errors ) ) {
+ core.setFailed( 'The results of the strict analysis are malformed.' );
+ return;
+ }
+ strictLevel = asLevel( strictResults.level );
+ strictErrors = strictResults.errors.map( ( error ) => normalize( { ...error, analysis: 'strict', level: strictLevel } ) );
+ strictChangedInBase = Array.isArray( strictResults.changed_in_base ) ? strictResults.changed_in_base : [];
+ }
+
+ // The strict analysis includes everything the default one does, so an error it reports at a lower level is
+ // reported by both. Such an error is listed once, as found by the analysis of the whole codebase, and the
+ // strict one only adds what is left over. Errors are matched as they are below, apart from their line.
+ const errorKey = ( error ) => JSON.stringify( [ error.file, error.identifier, error.message ] );
+ const defaultCounts = new Map();
+ const defaultErrors = results.errors.map( ( error ) => normalize( { ...error, analysis: 'default', level: results.level } ) );
+ for ( const error of defaultErrors ) {
+ defaultCounts.set( errorKey( error ), ( defaultCounts.get( errorKey( error ) ) ?? 0 ) + 1 );
+ }
+ const strictOnly = strictErrors.filter( ( error ) => {
+ const count = defaultCounts.get( errorKey( error ) ) ?? 0;
+ if ( count > 0 ) {
+ defaultCounts.set( errorKey( error ), count - 1 );
+ return false;
+ }
+ return true;
} );
// An error is recognized from one run to the next by its file, identifier and message, but not its line,
@@ -107,10 +171,10 @@ jobs:
// is fixed or added, those after it shift to the history of the one before or after, so their first reports
// can be off, and the one shown as resolved or new is the last rather than the one that was. That is rarer
// than lines being added or removed above them, which would throw off matching them by line.
- const errors = results.errors.map( normalize );
+ const errors = [ ...defaultErrors, ...strictOnly ];
const occurrences = new Map();
for ( const error of [ ...errors ].sort( ( a, b ) => ( a.line ?? 0 ) - ( b.line ?? 0 ) ) ) {
- const key = JSON.stringify( [ error.file, error.identifier, error.message ] );
+ const key = errorKey( error );
const occurrence = occurrences.get( key ) ?? 0;
occurrences.set( key, occurrence + 1 );
error.key = `${ key }#${ occurrence }`;
@@ -164,7 +228,11 @@ jobs:
// Files the base branch has changed since the pull request branched from it, in which the line numbers
// reported can be off in the head commit, since the analysis ran on the head commit merged into the base.
- const changedInBase = new Set( Array.isArray( results.changed_in_base ) ? results.changed_in_base.filter( ( file ) => typeof file === 'string' ) : [] );
+ // Each analysis only lists those among the files it reported errors in, so the lists of both are combined.
+ const changedInBase = new Set(
+ [ ...( Array.isArray( results.changed_in_base ) ? results.changed_in_base : [] ), ...strictChangedInBase ]
+ .filter( ( file ) => typeof file === 'string' )
+ );
const lineMayBeOff = ( error ) => ! error.fixed && Boolean( error.line ) && changedInBase.has( error.file );
const filesWithLinesOff = new Set( active.filter( lineMayBeOff ).map( ( error ) => error.file ) );
@@ -206,7 +274,10 @@ jobs:
// GitHub shows only the first few annotations of each kind from a step on the page of the workflow run, so
// errors left out of a table are pointed to in the log of the step that reported them, which has them all.
- const where = `the log of the [workflow run](${ run.html_url }), in the “Report the analysis results” step`;
+ // Each analysis runs in a job of its own, and an error found only by the strict one is only in that job's log.
+ const where = strictOnly.length > 0
+ ? `the log of the [workflow run](${ run.html_url }), in the “Report the analysis results” step of each of its jobs (errors in strict paths are only in the “strict paths” job)`
+ : `the log of the [workflow run](${ run.html_url }), in the “Report the analysis results” step`;
const table = ( rows, rowLimit, { withResolution = false } = {} ) => {
const shown = rows.slice( 0, rowLimit );
if ( shown.length === 0 ) {
@@ -215,10 +286,14 @@ jobs:
: `The ${ rows.length } errors are not listed here, to keep this comment short. They are listed in ${ where }.`;
}
const more = `…and ${ rows.length - shown.length } more, which are listed in ${ where }.`;
+ // The rule level is only shown in a table listing an error from the strict analysis, so that one listing
+ // only errors from the analysis of the whole codebase looks as it did before there were two. A level
+ // that was not reported, as by a branch from before it was, is left blank.
+ const withLevel = shown.some( ( error ) => error.analysis === 'strict' );
const lines = [
- `| Location | Error | Identifier | First reported |${ withResolution ? ' Resolved |' : '' }`,
- `| --- | --- | --- | --- |${ withResolution ? ' --- |' : '' }`,
- ...shown.map( ( error ) => `| ${ location( error ) } | ${ code( error.message ) } | ${ identifier( error ) } | ${ commit( error.introduced ) } |${ withResolution ? ` ${ commit( error.fixed ) } |` : '' }` ),
+ `| Location | Error | Identifier |${ withLevel ? ' Level |' : '' } First reported |${ withResolution ? ' Resolved |' : '' }`,
+ `| --- | --- | --- |${ withLevel ? ' --- |' : '' } --- |${ withResolution ? ' --- |' : '' }`,
+ ...shown.map( ( error ) => `| ${ location( error ) } | ${ code( error.message ) } | ${ identifier( error ) } |${ withLevel ? ` ${ error.level ?? '' } |` : '' } ${ commit( error.introduced ) } |${ withResolution ? ` ${ commit( error.fixed ) } |` : '' }` ),
];
if ( shown.length < rows.length ) {
lines.push( '', more );
@@ -248,6 +323,11 @@ jobs:
`> ${ filesWithLinesOff.size === 1 ? 'A file with errors has' : `${ filesWithLinesOff.size } files with errors have` } changed in ${ code( pr.base.ref ) } since this branch was last updated, so the line numbers reported in ${ filesWithLinesOff.size === 1 ? 'it' : 'them' } may be off and are not linked. Merge the latest ${ code( pr.base.ref ) } into this branch for accurate links.`,
].join( '\n' ) );
}
+ if ( active.some( ( error ) => error.analysis === 'strict' ) ) {
+ const strictError = strictLevel === null ? 'An error found by the strict analysis' : `An error at level ${ strictLevel }`;
+ const stricterLevel = strictLevel === null ? 'a stricter rule level' : `rule level ${ strictLevel }`;
+ sections.push( `${ strictError } is in a path that ${ code( 'phpstan-strict.neon.dist' ) } holds to ${ stricterLevel }, which the rest of the codebase is not yet held to. See [Stricter analysis of selected paths](${ readmeUrl }#stricter-analysis-of-selected-paths).` );
+ }
} else {
// Resolved by the last commit that resolved anything, so that later commits do not change the comment.
const resolvedBy = resolved.at( -1 )?.fixed ?? run.head_sha;
@@ -316,8 +396,8 @@ jobs:
// The errors tracked are taken in the order they are listed, so that each one listed keeps its history.
const tracked = [ ...unignorable, ...ignorable ].slice( 0, trackedLimit ).concat( resolved ).map( ( error ) => {
- const { key, file, line, message, identifier, ignorable, introduced, seen, fixed } = error;
- return { key, file, line: lineMayBeOff( error ) ? null : line, message, identifier, ignorable, introduced, seen, fixed };
+ const { key, file, line, message, identifier, ignorable, analysis, level, introduced, seen, fixed } = error;
+ return { key, file, line: lineMayBeOff( error ) ? null : line, message, identifier, ignorable, analysis, level, introduced, seen, fixed };
} );
sections.push( `` );
diff --git a/.github/workflows/phpstan-static-analysis.yml b/.github/workflows/phpstan-static-analysis.yml
index f0eaad6d015f3..386a71cece831 100644
--- a/.github/workflows/phpstan-static-analysis.yml
+++ b/.github/workflows/phpstan-static-analysis.yml
@@ -17,11 +17,13 @@ on:
- 'composer.*'
# These files configure PHPStan. Changes could affect the outcome.
- 'phpstan.neon.dist'
+ - 'phpstan-strict.neon.dist'
- 'tests/phpstan/base.neon'
- 'tests/phpstan/baselines/**'
+ - 'tests/phpstan/baselines-strict/**'
# Confirm any changes to relevant workflow files.
- '.github/workflows/phpstan-static-analysis.yml'
- - '.github/workflows/reusable-phpstan-static-analysis-v1.yml'
+ - '.github/workflows/reusable-phpstan-static-analysis-v2.yml'
workflow_dispatch:
# Cancels all previous workflow runs for pull requests that have not completed.
@@ -39,7 +41,7 @@ jobs:
# Runs PHPStan Static Analysis.
phpstan:
name: PHP static analysis
- uses: ./.github/workflows/reusable-phpstan-static-analysis-v1.yml
+ uses: ./.github/workflows/reusable-phpstan-static-analysis-v2.yml
permissions:
contents: read
if: |
diff --git a/.github/workflows/reusable-download-wordpress-release.yml b/.github/workflows/reusable-download-wordpress-release.yml
new file mode 100644
index 0000000000000..ec953abbfd58f
--- /dev/null
+++ b/.github/workflows/reusable-download-wordpress-release.yml
@@ -0,0 +1,101 @@
+##
+# A reusable workflow that downloads a WordPress release zip once and shares it as an artifact.
+#
+# For a while after a release is uploaded, some WordPress.org download servers do not have the new zip yet.
+# This workflow waits until the zip downloads and passes its md5 check, so the jobs that use it do not each fail.
+##
+name: Download a WordPress release
+
+on:
+ workflow_call:
+ inputs:
+ version:
+ description: 'The WordPress version to download. "latest", "nightly", "trunk" and "develop" are not downloaded.'
+ type: string
+ required: true
+ outputs:
+ artifact:
+ description: 'The name of the artifact that holds wordpress.zip, or an empty string when nothing was downloaded.'
+ value: ${{ jobs.download.outputs.artifact }}
+
+# Disable permissions for all available scopes by default.
+# Any needed permissions should be configured at the job level.
+permissions: {}
+
+jobs:
+ # Downloads the release zip and uploads it as an artifact.
+ #
+ # Performs the following steps:
+ # - Sets up PHP and WP-CLI.
+ # - Downloads the release zip, retrying until it is available.
+ # - Uploads the zip as an artifact.
+ download:
+ name: Download WordPress ${{ inputs.version }}
+ permissions:
+ contents: read
+ runs-on: ubuntu-26.04
+ timeout-minutes: 50
+ outputs:
+ artifact: ${{ steps.upload.outcome == 'success' && 'wordpress-release' || '' }}
+
+ steps:
+ - name: Check whether the version is a release
+ id: check
+ run: |
+ case "${WP_VERSION}" in
+ latest|nightly|trunk|develop) echo "release=false" >> "$GITHUB_OUTPUT" ;;
+ *) echo "release=true" >> "$GITHUB_OUTPUT" ;;
+ esac
+ env:
+ WP_VERSION: ${{ inputs.version }}
+
+ - name: Set up PHP
+ if: ${{ steps.check.outputs.release == 'true' }}
+ uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
+ with:
+ php-version: '8.4'
+ coverage: none
+
+ # This job does not check out the repository: `$/` fetches the action from this workflow's commit.
+ - name: Set up WP-CLI
+ if: ${{ steps.check.outputs.release == 'true' }}
+ uses: $/.github/actions/setup-wp-cli
+
+ # A missing md5 checksum is only a warning in WP-CLI, so a try passes only when the hash was verified.
+ # The URL form always saves a zip; `--version` can save a tar.gz.
+ - name: Download WordPress ${{ inputs.version }}
+ if: ${{ steps.check.outputs.release == 'true' }}
+ run: |
+ until output=$(wp core download "https://wordpress.org/wordpress-${WP_VERSION}.zip" --no-extract --path="$DOWNLOAD_DIR" 2>&1) \
+ && grep -q 'md5 hash verified' <<< "$output"; do
+ echo "$output"
+
+ if (( SECONDS + RETRY_DELAY_SECONDS > MAX_WAIT_SECONDS )); then
+ echo "::error::WordPress ${WP_VERSION} could not be downloaded after ${SECONDS} seconds."
+ exit 1
+ fi
+
+ echo "Trying again in ${RETRY_DELAY_SECONDS} seconds."
+ sleep "$RETRY_DELAY_SECONDS"
+ rm -rf "$DOWNLOAD_DIR"
+ done
+
+ echo "$output"
+ echo "Downloaded WordPress ${WP_VERSION} after waiting ${SECONDS} seconds."
+ mv "$DOWNLOAD_DIR"/wp_*.zip "$DOWNLOAD_DIR/wordpress.zip"
+ env:
+ WP_VERSION: ${{ inputs.version }}
+ DOWNLOAD_DIR: ${{ runner.temp }}/wordpress-release
+ MAX_WAIT_SECONDS: 2700 # 45 minutes.
+ RETRY_DELAY_SECONDS: 60
+
+ - name: Upload the release zip
+ id: upload
+ if: ${{ steps.check.outputs.release == 'true' }}
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: wordpress-release
+ path: ${{ runner.temp }}/wordpress-release/wordpress.zip
+ if-no-files-found: error
+ overwrite: true
+ retention-days: 30
diff --git a/.github/workflows/reusable-phpstan-static-analysis-v1.yml b/.github/workflows/reusable-phpstan-static-analysis-v1.yml
index 9a80af539ae13..cda319835e645 100644
--- a/.github/workflows/reusable-phpstan-static-analysis-v1.yml
+++ b/.github/workflows/reusable-phpstan-static-analysis-v1.yml
@@ -1,7 +1,7 @@
##
# A reusable workflow that runs PHP Static Analysis tests.
#
-# This workflow is used by `trunk` and branches >= 7.0.
+# This workflow is used by branches 7.0 and 7.1.
##
name: PHP Static Analysis
@@ -283,9 +283,9 @@ jobs:
composer phpstan:fix
```
- That runs PHPStan with `--fix`, which lowers the counts in the files under [`tests/phpstan/baselines`][baselines], removes the entries that no longer match, and removes any `@phpstan-ignore` annotation in the code that no longer ignores anything. It then deletes any baseline left with no entries, and updates the list of them in `phpstan.neon.dist`.
+ That runs PHPStan with `--fix`, which lowers the counts in the files under [`tests/phpstan/baselines`][baselines], removes the entries that no longer match, and removes any `@phpstan-ignore` annotation in the code that no longer ignores anything. It then deletes any baseline left with no entries.
- Alternatively, regenerate the baselines with `npm run typecheck:php:baselines` or `composer phpstan:baselines`. That also deletes any baseline whose errors are now all fixed, and updates the list of them in `phpstan.neon.dist`, but it does not clear an `@phpstan-ignore` annotation.
+ Alternatively, regenerate the baselines with `npm run typecheck:php:baselines` or `composer phpstan:baselines`. That also deletes any baseline whose errors are now all fixed, but it does not clear an `@phpstan-ignore` annotation.
See [`tests/phpstan/README.md`][readme] for details.
diff --git a/.github/workflows/reusable-phpstan-static-analysis-v2.yml b/.github/workflows/reusable-phpstan-static-analysis-v2.yml
new file mode 100644
index 0000000000000..2973de0ca40a2
--- /dev/null
+++ b/.github/workflows/reusable-phpstan-static-analysis-v2.yml
@@ -0,0 +1,384 @@
+##
+# A reusable workflow that runs PHP Static Analysis tests.
+#
+# This workflow is used by `trunk` and branches >= 7.2.
+##
+name: PHP Static Analysis
+
+on:
+ workflow_call:
+ inputs:
+ php-version:
+ description: 'The PHP version to use.'
+ required: false
+ type: 'string'
+ default: 'latest'
+
+# Disable permissions for all available scopes by default.
+# Any needed permissions should be configured at the job level.
+permissions: {}
+
+jobs:
+ # Runs PHP static analysis tests.
+ #
+ # Core is analyzed twice, in parallel: the whole codebase with phpstan.neon.dist, and the paths held to a stricter rule
+ # level with phpstan-strict.neon.dist. See tests/phpstan/README.md.
+ #
+ # Violations are reported inline with annotations. For pull requests, the results of each analysis are also uploaded
+ # as an artifact, and the PHPStan Pull Request Comments workflow combines them in a comment.
+ #
+ # Performs the following steps:
+ # - Checks out the repository.
+ # - Sets up PHP.
+ # - Logs debug information.
+ # - Installs Composer dependencies.
+ # - Make Composer packages available globally.
+ # - Builds WordPress.
+ # - Configures caching for PHPStan static analysis scans.
+ # - Runs PHPStan static analysis.
+ # - Reports the results as annotations.
+ # - Uploads the results as an artifact (pull requests only).
+ # - Checks for errors that cannot be reported as warnings, such as out-of-date baselines.
+ # - Saves the PHPStan result cache.
+ # - Ensures version-controlled files are not modified or deleted.
+ phpstan:
+ name: Run PHP static analysis (${{ matrix.label }})
+ runs-on: ubuntu-26.04
+ permissions:
+ contents: read
+ timeout-minutes: 20
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ # The artifact of the analysis of the whole codebase keeps the name it had before there were two, which is
+ # the name the PHPStan Pull Request Comments workflow on trunk requires. That way the comment is kept up to
+ # date for a pull request whose branch does not have the second analysis yet.
+ #
+ # The analyses are named for their role rather than their rule level, which is read from the configuration
+ # when the results are reported, so that raising either level is an edit of its configuration alone.
+ - analysis: default
+ label: all paths
+ config: phpstan.neon.dist
+ baselines: tests/phpstan/baselines
+ script: phpstan:default
+ artifact: phpstan-results
+ - analysis: strict
+ label: strict paths
+ config: phpstan-strict.neon.dist
+ baselines: tests/phpstan/baselines-strict
+ script: phpstan:strict
+ artifact: phpstan-results-strict
+
+ steps:
+ # For a pull request, the parents of the merge commit are fetched too, to find the files that the base branch
+ # has changed since the pull request branched from it.
+ - name: Checkout repository
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
+ with:
+ show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
+ persist-credentials: false
+ fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 1 }}
+
+ - name: Set up PHP
+ uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
+ with:
+ php-version: ${{ inputs.php-version }}
+ coverage: none
+
+ - name: General debug information
+ run: |
+ composer --version
+
+ # Since Composer dependencies are installed using `composer update` and no lock file is in version control,
+ # passing a custom cache suffix ensures that the cache is flushed at least once per week.
+ - name: Install Composer dependencies
+ uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
+ with:
+ custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
+
+ - name: Make Composer packages available globally
+ run: echo "${PWD}/vendor/bin" >> "$GITHUB_PATH"
+
+ # The directory holds more than the analysis results. PHPStan also stores what it read out of
+ # each source file there, the docblocks and signatures it found, keyed by that file's contents
+ # and nothing else. The extensions in `tests/phpstan` change what reading a file yields without
+ # changing the file: a parser node visitor rewrites a docblock in the syntax tree, and the bytes
+ # on disk stay as they were. A cache written before one of them changed therefore answers with
+ # what the old code saw, and the analysis silently runs against types no longer derived.
+ #
+ # Keying on the configuration and the extensions keeps a run from restoring a cache that
+ # predates either. The baselines are left out of the key: they only decide which reported errors
+ # are ignored, PHPStan invalidates the results cache on a configuration change by itself, and
+ # including them would discard the whole cache every time one is regenerated.
+ #
+ # The cache is renamed rather than only prefixed, because the key this replaces restored on
+ # `phpstan-result-cache-`, which every key below still begins with. A branch that has not
+ # merged this commit yet runs the workflow it has, and that workflow would prefix-match the
+ # caches written here: it would analyse without the extensions against reflection derived with
+ # them. A name of its own leaves those runs restoring only their own caches.
+ #
+ # Each analysis caches separately. Its result cache records the rule level, and is discarded
+ # by a run at another level, so restoring the other analysis's cache would gain nothing.
+ - name: Cache PHP Static Analysis scan cache
+ uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ with:
+ path: .cache # This is defined in the base.neon file.
+ key: "phpstan-analysis-cache-${{ matrix.analysis }}-${{ hashFiles('phpstan.neon.dist', 'phpstan-strict.neon.dist', 'tests/phpstan/*.neon', 'tests/phpstan/*.php') }}-${{ github.run_id }}"
+ restore-keys: |
+ phpstan-analysis-cache-${{ matrix.analysis }}-${{ hashFiles('phpstan.neon.dist', 'phpstan-strict.neon.dist', 'tests/phpstan/*.neon', 'tests/phpstan/*.php') }}-
+
+ - name: Run PHP static analysis tests
+ id: phpstan
+ env:
+ SCRIPT: ${{ matrix.script }}
+ run: |
+ # The report is written to a file for the steps below, which turn it into annotations,
+ # the pull request comment, and a check for errors that cannot be reported as warnings.
+ # Only the report goes to standard output; the debug output goes to standard error, so
+ # it stays in the log without corrupting the JSON.
+ #
+ # The step shell exits on the first failing command, which would also end the step on
+ # the status of 1 that PHPStan uses for reporting errors. Capture the status instead.
+ status=0
+ composer run "${SCRIPT}" -- -vvv --error-format=json > "${RUNNER_TEMP}/phpstan-report.json" || status=$?
+
+ # PHPStan exits 1 when it has errors to report, which is the expected case here and
+ # is what the annotations are for. Anything higher means it did not finish at all.
+ if [ "${status}" -gt 1 ]; then
+ echo "::error title=PHPStan did not complete::The analysis exited with status ${status}, so the code was not fully checked. This is a failure of the run itself rather than a problem found in the code."
+ exit "${status}"
+ fi
+
+ # Errors are annotated as warnings, so that they are visible on the pull request without
+ # failing the run. The exception is an error that PHPStan does not allow to be ignored,
+ # such as an out-of-date baseline entry, or one that is not specific to a file. These are
+ # annotated as errors instead, and the run fails on them in the check further below.
+ #
+ # The results are also written out for the PHPStan Pull Request Comments workflow, which
+ # runs with the permissions needed to comment on the pull request. Only the facts are
+ # passed along: the comment is composed there, since a pull request can change anything
+ # that runs here.
+ - name: Report the analysis results
+ id: report
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ env:
+ ANALYSIS: ${{ matrix.analysis }}
+ CONFIG: ${{ matrix.config }}
+ with:
+ script: |
+ const fs = require( 'fs' );
+
+ // The rule level the configuration analyzes at, as a number, or `max`. Only the line of the parameter is
+ // matched, rather than decoding the whole dump, because the JSON PHPStan prints can be invalid: it writes
+ // the `\<` in a message pattern as is, which is not a valid JSON escape.
+ let level = null;
+ try {
+ const parameters = require( 'child_process' ).execFileSync(
+ `${ process.env.GITHUB_WORKSPACE }/vendor/bin/phpstan`,
+ [ 'dump-parameters', `--configuration=${ process.env.CONFIG }`, '--json' ],
+ { encoding: 'utf8' }
+ );
+ const match = parameters.match( /^\s*"level":\s*"?(max|\d+)"?,?$/m );
+ if ( match ) {
+ level = match[ 1 ] === 'max' ? 'max' : Number( match[ 1 ] );
+ }
+ } catch ( error ) {
+ core.warning( `The rule level of ${ process.env.CONFIG } could not be read: ${ error.message }` );
+ }
+
+ // Annotations from the stricter analysis say so, since the same code can pass the other one.
+ const analysis = process.env.ANALYSIS;
+ const titlePrefix = analysis === 'strict' ? `PHPStan (strict${ level === null ? '' : `, level ${ level }` })` : 'PHPStan';
+
+ const report = JSON.parse( fs.readFileSync( `${ process.env.RUNNER_TEMP }/phpstan-report.json`, { encoding: 'utf8' } ) );
+ const workspace = `${ process.env.GITHUB_WORKSPACE }/`;
+
+ const errors = [];
+ for ( const [ absolutePath, file ] of Object.entries( report.files ) ) {
+ const relativePath = absolutePath.startsWith( workspace ) ? absolutePath.slice( workspace.length ) : absolutePath;
+ for ( const message of file.messages ) {
+ errors.push( {
+ file: relativePath,
+ line: message.line ?? null,
+ message: message.message,
+ identifier: message.identifier ?? null,
+ tip: message.tip ?? null,
+ ignorable: message.ignorable,
+ fixable: message.fixable ?? false,
+ } );
+ }
+ }
+
+ // Errors that are not specific to a file, such as an `ignoreErrors` entry from a config
+ // file PHPStan cannot locate it in. These cannot be ignored either.
+ for ( const message of report.errors ) {
+ errors.push( { file: null, line: null, message, identifier: null, tip: null, ignorable: false, fixable: false } );
+ }
+
+ // PHPStan marks an error it can fix itself, such as a stale baseline entry, as fixable.
+ const fixHint = 'This can be fixed automatically by running `composer phpstan:fix` (or `npm run typecheck:php:fix`).';
+
+ for ( const error of errors ) {
+ const properties = { title: error.identifier ? `${ titlePrefix }: ${ error.identifier }` : titlePrefix };
+ if ( error.file ) {
+ properties.file = error.file;
+ }
+ if ( error.line ) {
+ properties.startLine = error.line;
+ }
+ const message = [ error.message, error.tip, error.fixable ? fixHint : null ].filter( Boolean ).join( '\n' );
+ if ( error.ignorable ) {
+ core.warning( message, properties );
+ } else {
+ core.error( message, properties );
+ }
+ }
+
+ // Tips and whether an error is fixable are left out of the results, since they are only shown in the
+ // annotations, next to the code.
+ //
+ // The commit analyzed is the pull request merged into its base branch, whose second parent is the head
+ // commit. The files with errors that differ between the two are those the base branch has changed, in
+ // which the line numbers reported can be off in the head commit.
+ //
+ // Each analysis writes its own results. Those of the analysis of the whole codebase also list every
+ // analysis the run makes, so that the comment is not updated from only some of them: an error missing
+ // because its analysis did not upload results would otherwise be shown as resolved.
+ if ( context.eventName === 'pull_request' ) {
+ let changedInBase = [];
+ try {
+ const filesWithErrors = new Set( errors.map( ( error ) => error.file ) );
+ changedInBase = require( 'child_process' )
+ .execFileSync( 'git', [ 'diff', '--name-only', '--no-renames', 'HEAD^2', 'HEAD' ], { encoding: 'utf8' } )
+ .split( '\n' )
+ .filter( ( file ) => filesWithErrors.has( file ) );
+ } catch ( error ) {
+ core.warning( `The files changed in the base branch could not be found: ${ error.message }` );
+ }
+ fs.mkdirSync( `${ process.env.RUNNER_TEMP }/phpstan-results`, { recursive: true } );
+ fs.writeFileSync( `${ process.env.RUNNER_TEMP }/phpstan-results/results.json`, JSON.stringify( {
+ pull_request: context.payload.pull_request.number,
+ analysis,
+ level,
+ // Keep this list in step with the `analysis` values of the job's matrix.
+ ...( analysis === 'default' ? { analyses: [ 'default', 'strict' ] } : {} ),
+ changed_in_base: changedInBase,
+ errors: errors.map( ( { tip, fixable, ...error } ) => error ),
+ } ) );
+ }
+
+ # Uploads the results for the PHPStan Pull Request Comments workflow, which keeps a comment on the
+ # pull request up to date with them.
+ - name: Upload the analysis results as an artifact
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ if: ${{ github.event_name == 'pull_request' && steps.report.outcome == 'success' }}
+ with:
+ name: ${{ matrix.artifact }}
+ path: ${{ runner.temp }}/phpstan-results/
+
+ # Some errors cannot be ignored, so they cannot be reported as warnings either. Most often
+ # this is an ignored error that no longer occurs, or occurs a different number of times,
+ # which is reported under an `ignore.*` identifier. That is not something to fix in the
+ # code: the usual cause is that the error *was* fixed, leaving a baseline describing a state
+ # that no longer exists.
+ #
+ # Such an error is reported without a line number, so its annotation is not shown alongside
+ # the changes in the pull request, and one that is not specific to a file has nowhere to be
+ # shown at all. A passing run would let it go unnoticed, so fail the run on it instead, and
+ # say what to do about it.
+ #
+ # Detection is on PHPStan's own `ignorable` flag rather than on the identifier or message.
+ - name: Check for errors that cannot be reported as warnings
+ if: ${{ !cancelled() }}
+ env:
+ BASELINES_URL: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.sha }}/${{ matrix.baselines }}
+ LABEL: ${{ matrix.label }}
+ README_URL: ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/tests/phpstan/README.md
+ run: |
+ # This step runs even when the analysis above it failed, in which case the report may
+ # never have been written. That failure is reported there, so there is nothing to add
+ # here beyond staying quiet about a file that was never going to exist.
+ report="${RUNNER_TEMP}/phpstan-report.json"
+ if [ ! -f "${report}" ]; then
+ exit 0
+ fi
+
+ # Errors that are not specific to a file are listed separately from the rest, and are
+ # never ignorable.
+ unignorable=$( jq '[ .files[].messages[] | select( .ignorable | not ) ] + .errors | length' "${report}" )
+ if [ "${unignorable}" -eq 0 ]; then
+ exit 0
+ fi
+
+ # Whether the errors include ignore errors decides what to say about them, but not whether to
+ # fail: every error that reaches this point fails the run. Ignore errors concern an ignore
+ # configuration that no longer describes the code. They are `ignore.unmatched`, where a
+ # pattern matched nothing at all, and `ignore.count`, where it matched a different number of
+ # times than the entry records. The `ignore.` prefix is matched rather than those two names
+ # so that any later addition to the group is caught as well. Any other error that cannot be
+ # ignored is something regenerating the baselines would not help with, so it is reported
+ # plainly instead.
+ ignore_errors=$( jq '[ .files[].messages[] | select( .identifier // "" | startswith( "ignore." ) ) ] | length' "${report}" )
+
+ # The summary is Markdown, and its code spans and fences are written literally, so the
+ # heredoc is quoted to keep the backticks out of the shell's hands. The links are
+ # written in reference style for the same reason: the URLs are the only part needing
+ # a variable, so defining them afterwards keeps the whole of the prose in here.
+ #
+ # A newline renders as a line break rather than a space, so each paragraph is one
+ # line however long that makes it, and the rendered summary wraps to its own width.
+ #
+ # The heading names the analysis whose baselines are out of date, which is filled in for
+ # the LABEL placeholder when the summary is written, since the heredoc expands nothing.
+ baselines_summary=$( cat <<'SUMMARY'
+ ## PHPStan baselines are out of date (LABEL)
+
+ An ignored error no longer occurs, or occurs a different number of times, so PHPStan reported it under an `ignore.unmatched` or `ignore.count` identifier.
+
+ **If you fixed the error, this is expected.** Each baseline entry records an exact count for a specific file, so that a new occurrence of an already baselined error is reported rather than absorbed. That same exactness means fixing one leaves the baseline describing a state that no longer exists. There is nothing to fix in the code; the baselines just need to catch up.
+
+ Remove the stale entries, and commit the result:
+
+ ```bash
+ npm run typecheck:php:fix
+ ```
+
+ or, outside the Docker environment:
+
+ ```bash
+ composer phpstan:fix
+ ```
+
+ That runs PHPStan with `--fix`, which lowers the counts in [the baselines][baselines], removes the entries that no longer match, and removes any `@phpstan-ignore` annotation in the code that no longer ignores anything. It then deletes any baseline left with no entries.
+
+ Alternatively, regenerate the baselines with `npm run typecheck:php:baselines` or `composer phpstan:baselines`. That also deletes any baseline whose errors are now all fixed, but it does not clear an `@phpstan-ignore` annotation.
+
+ See [`tests/phpstan/README.md`][readme] for details.
+
+ SUMMARY
+ )
+
+ if [ "${ignore_errors}" -gt 0 ]; then
+ {
+ printf '%s\n\n' "${baselines_summary/LABEL/${LABEL}}"
+ echo "[baselines]: ${BASELINES_URL}"
+ echo "[readme]: ${README_URL}"
+ } >> "${GITHUB_STEP_SUMMARY}"
+
+ echo "::error title=PHPStan baselines are out of date (${LABEL})::An ignored error no longer occurs, or occurs a different number of times. If you fixed it, that is expected: run \`npm run typecheck:php:fix\` or \`composer phpstan:fix\` and commit the updated baselines. See ${README_URL}"
+ else
+ echo "::error title=PHPStan reported errors that cannot be ignored (${LABEL})::PHPStan reported ${unignorable} error(s) that cannot be ignored or reported as warnings. See the error annotations for details, and ${README_URL} for how to run the analysis locally."
+ fi
+
+ exit 1
+
+ - name: "Save result cache"
+ uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
+ if: ${{ !cancelled() }}
+ with:
+ path: .cache
+ key: "phpstan-analysis-cache-${{ matrix.analysis }}-${{ hashFiles('phpstan.neon.dist', 'phpstan-strict.neon.dist', 'tests/phpstan/*.neon', 'tests/phpstan/*.php') }}-${{ github.run_id }}"
+
+ - name: Ensure version-controlled files are not modified or deleted
+ run: git diff --exit-code
diff --git a/.github/workflows/reusable-upgrade-testing.yml b/.github/workflows/reusable-upgrade-testing.yml
index cc36c1a80587a..6510ba6818249 100644
--- a/.github/workflows/reusable-upgrade-testing.yml
+++ b/.github/workflows/reusable-upgrade-testing.yml
@@ -17,6 +17,11 @@ on:
description: 'The version of WordPress to update to. Use "latest" to update to the latest version, "develop" to update to the current branch, or provide a specific version number to update to.'
type: 'string'
default: 'latest'
+ new-version-artifact:
+ description: 'Optional. The name of an artifact that holds the wordpress.zip of new-version. When set, the upgrade installs from it instead of downloading.'
+ required: false
+ type: 'string'
+ default: ''
php:
description: 'The version of PHP to use. Expected format: X.Y.'
required: true
@@ -137,8 +142,29 @@ jobs:
run: |
wp core update develop.zip
+ - name: Download the WordPress ${{ inputs.new-version }} artifact
+ if: ${{ inputs.new-version != 'develop' && inputs.new-version-artifact != '' }}
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ with:
+ name: ${{ inputs.new-version-artifact }}
+
+ # With a zip, WP-CLI does not stop a downgrade, and the minor update can already be past the target.
+ # `sort -V` orders 7.2 before 7.2-RC2, so compare the way WordPress does.
+ - name: Upgrade to WordPress ${{ inputs.new-version }} from the artifact
+ if: ${{ inputs.new-version != 'develop' && inputs.new-version-artifact != '' }}
+ run: |
+ current=$(wp core version)
+ if ! CURRENT="$current" php -r 'exit( version_compare( getenv( "CURRENT" ), getenv( "WP_VERSION" ), "<" ) ? 0 : 1 );'; then
+ echo "WordPress ${current} is not older than ${WP_VERSION}, so there is nothing to upgrade."
+ exit 0
+ fi
+
+ wp core update wordpress.zip --version="$WP_VERSION"
+ env:
+ WP_VERSION: ${{ inputs.new-version }}
+
- name: Upgrade to WordPress ${{ inputs.new-version }}
- if: ${{ inputs.new-version != 'develop' }}
+ if: ${{ inputs.new-version != 'develop' && inputs.new-version-artifact == '' }}
run: |
wp core update ${{ 'latest' != inputs.new-version && '--version="${WP_VERSION}"' || '' }}
env:
diff --git a/.github/workflows/test-old-branches.yml b/.github/workflows/test-old-branches.yml
index a7d2ddcb01836..c858088879b95 100644
--- a/.github/workflows/test-old-branches.yml
+++ b/.github/workflows/test-old-branches.yml
@@ -25,7 +25,7 @@ on:
permissions: {}
env:
- CURRENTLY_SUPPORTED_BRANCH: '7.1'
+ CURRENTLY_SUPPORTED_BRANCH: '7.2'
jobs:
dispatch-workflows-for-old-branches:
@@ -45,13 +45,15 @@ jobs:
'test-build-processes.yml'
]
branch: [
- '7.1', '7.0',
+ '7.2', '7.1', '7.0',
'6.9', '6.8', '6.7', '6.6', '6.5', '6.4', '6.3', '6.2', '6.1','6.0',
'5.9', '5.8', '5.7', '5.6', '5.5', '5.4', '5.3', '5.2', '5.1', '5.0',
'4.9', '4.8', '4.7'
]
include:
# PHP Compatibility testing was introduced in 5.5.
+ - branch: '7.2'
+ workflow: 'php-compatibility.yml'
- branch: '7.1'
workflow: 'php-compatibility.yml'
- branch: '7.0'
@@ -90,6 +92,8 @@ jobs:
# End-to-end testing was introduced in 5.3 but was later removed as there were no meaningful assertions.
# Starting in 5.8 with #52905, some additional tests with real assertions were introduced.
# Branches 5.8 and newer should be tested to confirm no regressions are introduced.
+ - branch: '7.2'
+ workflow: 'end-to-end-tests.yml'
- branch: '7.1'
workflow: 'end-to-end-tests.yml'
- branch: '7.0'
@@ -122,9 +126,9 @@ jobs:
# Performance testing was introduced in 6.2 using Puppeteer but was overhauled to use Playwright instead in 6.4.
# Since the workflow frequently failed for 6.2 and 6.3 due to the flaky nature of the Puppeteer tests,
# the workflow was removed from those two branches.
- - branch: '7.1'
+ - branch: '7.2'
workflow: 'performance.yml'
- - branch: '7.0'
+ - branch: '7.1'
workflow: 'performance.yml'
# Run all branches monthly, but only the currently supported one twice per month.
diff --git a/.github/workflows/upgrade-develop-testing.yml b/.github/workflows/upgrade-develop-testing.yml
index dcd921c2e6c7e..1073c46786c0b 100644
--- a/.github/workflows/upgrade-develop-testing.yml
+++ b/.github/workflows/upgrade-develop-testing.yml
@@ -92,7 +92,7 @@ jobs:
db-type: [ 'mysql' ]
db-version: [ '5.7', '8.4' ]
# WordPress 5.3 is the oldest version that supports PHP 7.4.
- wp: [ '5.3', '7.0', '7.1' ]
+ wp: [ '5.3', '7.0', '7.1', '7.2-RC3' ]
multisite: [ false, true ]
with:
os: ${{ matrix.os }}
@@ -126,7 +126,7 @@ jobs:
php: [ '7.4', '8.4' ]
db-type: [ 'mysql' ]
db-version: [ '8.4' ]
- wp: [ '7.0', '7.1' ]
+ wp: [ '7.0', '7.1', '7.2-RC3' ]
multisite: [ false, true ]
with:
os: ${{ matrix.os }}
diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml
index d4817522585d9..59eec3837613a 100644
--- a/.github/workflows/upgrade-testing.yml
+++ b/.github/workflows/upgrade-testing.yml
@@ -14,6 +14,7 @@ on:
- '.github/actions/smoke-check/**'
- '.github/workflows/upgrade-testing.yml'
- '.github/workflows/reusable-upgrade-testing.yml'
+ - '.github/workflows/reusable-download-wordpress-release.yml'
pull_request:
# This workflow is only meant to run from trunk. Pull requests changing this file with different BASE branches should be ignored.
branches:
@@ -24,6 +25,7 @@ on:
- '.github/actions/run-with-retry/**'
- '.github/workflows/upgrade-testing.yml'
- '.github/workflows/reusable-upgrade-testing.yml'
+ - '.github/workflows/reusable-download-wordpress-release.yml'
workflow_dispatch:
inputs:
new-version:
@@ -92,7 +94,7 @@ jobs:
env:
NEW_VERSION: ${{ inputs.new-version && inputs.new-version || 'latest' }}
# The versions each job below starts from. See the comment on the job for why those versions are tested.
- RECENT_RELEASES: '7.0 7.1' # upgrade-tests-recent-releases
+ RECENT_RELEASES: '7.0 7.1 7.2-RC3' # upgrade-tests-recent-releases
WP_6X: '6.0 6.3 6.4 6.5' # upgrade-tests-wp-6x-mysql
WP_5X_PHP_7X: '5.0 5.1 5.3 5.4 5.5 5.6 5.9' # upgrade-tests-wp-5x-php-7x-mysql
WP_5X_PHP_8X: '5.3 5.4 5.5 5.6 5.9' # upgrade-tests-wp-5x-php-8x-mysql
@@ -152,12 +154,22 @@ jobs:
filter wp-5x-php-8x "$WP_5X_PHP_8X"
filter oldest-wp "$OLDEST_WP"
+ # Downloads a release zip once for every matrix job, waiting until WordPress.org serves it.
+ download-wordpress:
+ name: Download WordPress
+ uses: $/.github/workflows/reusable-download-wordpress-release.yml
+ permissions:
+ contents: read
+ if: ${{ github.repository == 'WordPress/wordpress-develop' }}
+ with:
+ version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
+
# Tests the full list of PHP/MySQL combinations for the two most recent versions of WordPress.
upgrade-tests-recent-releases:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.recent-releases != '[]' }}
- needs: [ build-test-matrix ]
+ needs: [ build-test-matrix, download-wordpress ]
permissions:
contents: read
strategy:
@@ -177,13 +189,14 @@ jobs:
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
+ new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }}
# Tests 6.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 7 & 8.
upgrade-tests-wp-6x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.wp-6x != '[]' }}
- needs: [ build-test-matrix ]
+ needs: [ build-test-matrix, download-wordpress ]
permissions:
contents: read
strategy:
@@ -203,13 +216,14 @@ jobs:
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
+ new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }}
# Tests 5.x releases where the WordPress database version changed on the only supported version of PHP 7.
upgrade-tests-wp-5x-php-7x-mysql:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.wp-5x-php-7x != '[]' }}
- needs: [ build-test-matrix ]
+ needs: [ build-test-matrix, download-wordpress ]
permissions:
contents: read
strategy:
@@ -229,6 +243,7 @@ jobs:
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
+ new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }}
# Tests 5.x releases where the WordPress database version changed on the oldest and newest supported versions of PHP 8.
#
@@ -239,7 +254,7 @@ jobs:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.wp-5x-php-8x != '[]' }}
- needs: [ build-test-matrix ]
+ needs: [ build-test-matrix, download-wordpress ]
permissions:
contents: read
strategy:
@@ -259,6 +274,7 @@ jobs:
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
+ new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }}
# The oldest version of WordPress receiving security updates should always be tested against
# the widest possible list of PHP/MySQL combinations.
@@ -270,7 +286,7 @@ jobs:
name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }}
uses: ./.github/workflows/reusable-upgrade-testing.yml
if: ${{ github.repository == 'WordPress/wordpress-develop' && needs.build-test-matrix.outputs.oldest-wp != '[]' }}
- needs: [ build-test-matrix ]
+ needs: [ build-test-matrix, download-wordpress ]
permissions:
contents: read
strategy:
@@ -290,6 +306,7 @@ jobs:
wp: ${{ matrix.wp }}
new-version: ${{ inputs.new-version && inputs.new-version || 'latest' }}
multisite: ${{ matrix.multisite }}
+ new-version-artifact: ${{ needs.download-wordpress.outputs.artifact }}
slack-notifications:
name: Slack Notifications
@@ -297,7 +314,7 @@ jobs:
permissions:
actions: read
contents: read
- needs: [ build-test-matrix, upgrade-tests-recent-releases, upgrade-tests-wp-6x-mysql, upgrade-tests-wp-5x-php-7x-mysql, upgrade-tests-wp-5x-php-8x-mysql, upgrade-tests-oldest-wp-mysql ]
+ needs: [ build-test-matrix, download-wordpress, upgrade-tests-recent-releases, upgrade-tests-wp-6x-mysql, upgrade-tests-wp-5x-php-7x-mysql, upgrade-tests-wp-5x-php-8x-mysql, upgrade-tests-oldest-wp-mysql ]
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
with:
calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
diff --git a/.gitignore b/.gitignore
index 2d0178f495120..24b4282326304 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@ wp-tests-config.php
/tests/phpunit/build
/wp-cli.local.yml
/phpstan.neon
+/phpstan-strict.neon
/*.tsbuildinfo
/jsdoc
/composer.lock
diff --git a/.version-support-mysql.json b/.version-support-mysql.json
index 68c6d2ac77407..bcd6946aa9eb7 100644
--- a/.version-support-mysql.json
+++ b/.version-support-mysql.json
@@ -1,4 +1,14 @@
{
+ "7-3": [
+ "26.10",
+ "26.7",
+ "9.7",
+ "8.4",
+ "8.0",
+ "5.7",
+ "5.6",
+ "5.5"
+ ],
"7-2": [
"26.10",
"26.7",
diff --git a/.version-support-php.json b/.version-support-php.json
index 31d8169338822..057204cd67f65 100644
--- a/.version-support-php.json
+++ b/.version-support-php.json
@@ -1,4 +1,14 @@
{
+ "7-3": [
+ "7.4",
+ "8.0",
+ "8.1",
+ "8.2",
+ "8.3",
+ "8.4",
+ "8.5",
+ "8.6"
+ ],
"7-2": [
"7.4",
"8.0",
diff --git a/Gruntfile.js b/Gruntfile.js
index 0a9270f436847..05bdfda0a58c1 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -396,7 +396,7 @@ module.exports = function(grunt) {
[ WORKING_DIR + 'wp-includes/js/jquery/jquery.min.js' ]: [ './node_modules/jquery/dist/jquery.min.js' ],
[ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.js' ],
[ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.min.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.min.js' ],
- [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js' ]: [ './node_modules/jquery-form/src/jquery.form.js' ],
+ [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js' ]: [ './node_modules/jquery-form/dist/jquery.form.js' ],
[ WORKING_DIR + 'wp-includes/js/jquery/jquery.color.min.js' ]: [ './node_modules/jquery-color/dist/jquery.color.min.js' ],
[ WORKING_DIR + 'wp-includes/js/masonry.min.js' ]: [ './node_modules/masonry-layout/dist/masonry.pkgd.min.js' ],
[ WORKING_DIR + 'wp-includes/js/underscore.js' ]: [ './node_modules/underscore/underscore.js' ],
diff --git a/SECURITY.md b/SECURITY.md
index 13e8007009af8..b73d6ab5c0b6d 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -10,6 +10,7 @@ Full details of the WordPress Security Policy and the list of covered projects a
| Version | Supported |
|---------| --------- |
+| 7.2.x | Yes |
| 7.1.x | Yes |
| 7.0.x | Yes |
| 6.9.x | Yes |
diff --git a/composer.json b/composer.json
index dd7f57d5b6313..77226897cee1c 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
{
"name": "wordpress/wordpress",
- "version": "7.2.0",
+ "version": "7.3.0",
"license": "GPL-2.0-or-later",
"description": "WordPress is open source software you can use to create a beautiful website, blog, or app.",
"homepage": "https://wordpress.org",
@@ -52,9 +52,9 @@
"squizlabs/php_codesniffer": "3.13.5",
"wp-coding-standards/wpcs": "~3.4.1",
"phpcompatibility/phpcompatibility-wp": "~2.1.3",
- "phpstan/phpstan": "2.3.6",
+ "phpstan/phpstan": "2.3.7",
"phpstan/phpstan-phpunit": "2.1.2",
- "phpstan/phpstan-strict-rules": "2.1.1",
+ "phpstan/phpstan-strict-rules": "2.1.2",
"yoast/phpunit-polyfills": "^1.1.0"
},
"config": {
@@ -75,9 +75,11 @@
}
},
"scripts": {
- "phpstan": "@php ./vendor/bin/phpstan analyse --memory-limit=2G",
+ "phpstan": [ "Composer\\Config::disableProcessTimeout", "@php ./tests/phpstan/analyse.php --memory-limit=2G" ],
+ "phpstan:default": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/bin/phpstan analyse --configuration=phpstan.neon.dist --memory-limit=2G" ],
+ "phpstan:strict": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/bin/phpstan analyse --configuration=phpstan-strict.neon.dist --memory-limit=2G" ],
"phpstan:baselines": [ "Composer\\Config::disableProcessTimeout", "@php ./tests/phpstan/generate-baselines.php" ],
- "phpstan:fix": [ "Composer\\Config::disableProcessTimeout", "@phpstan --configuration=phpstan.neon.dist --fix", "@phpstan:baselines --prune", "@phpstan --configuration=phpstan.neon.dist" ],
+ "phpstan:fix": [ "Composer\\Config::disableProcessTimeout", "@php ./tests/phpstan/analyse.php --memory-limit=2G --fix" ],
"compat": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=phpcompat.xml.dist --report=summary,source",
"format": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --report=summary,source",
"lint": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --report=summary,source",
diff --git a/package-lock.json b/package-lock.json
index 89c91e4f79522..77cb8b4e307b5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "WordPress",
- "version": "7.2.0",
+ "version": "7.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "WordPress",
- "version": "7.2.0",
+ "version": "7.3.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"backbone": "1.6.1",
@@ -43,24 +43,24 @@
"devDependencies": {
"@343dev/gifsicle": "1.2.0",
"@lodder/grunt-postcss": "^3.1.1",
- "@napi-rs/image": "1.14.0",
- "@playwright/test": "1.64.1",
- "@pmmmwh/react-refresh-webpack-plugin": "0.6.2",
+ "@napi-rs/image": "1.16.0",
+ "@playwright/test": "1.65.1",
+ "@pmmmwh/react-refresh-webpack-plugin": "0.6.3",
"@types/backbone": "1.4.23",
- "@types/codemirror": "5.60.17",
+ "@types/codemirror": "5.60.18",
"@types/espree": "10.1.0",
"@types/htmlhint": "1.1.5",
"@types/jquery": "3.5.34",
- "@types/node": "20.19.43",
+ "@types/node": "24.19.2",
"@types/underscore": "1.13.0",
"@wordpress/e2e-test-utils-playwright": "1.51.0",
"@wordpress/prettier-config": "4.51.0",
"@wordpress/scripts": "33.0.0",
- "autoprefixer": "10.5.3",
+ "autoprefixer": "10.6.2",
"chokidar": "4.0.3",
"dotenv": "17.4.2",
"dotenv-expand": "13.0.0",
- "grunt": "1.6.2",
+ "grunt": "1.6.3",
"grunt-banner": "^0.6.0",
"grunt-contrib-clean": "~2.0.1",
"grunt-contrib-concat": "2.1.0",
@@ -75,23 +75,23 @@
"grunt-replace-lts": "~1.1.0",
"grunt-rtlcss": "~2.0.2",
"grunt-sass": "~4.1.0",
- "grunt-webpack": "7.0.1",
+ "grunt-webpack": "8.0.0",
"install-changed": "1.1.0",
"json2php": "0.0.12",
- "minimizer-webpack-plugin": "5.6.1",
+ "minimizer-webpack-plugin": "5.14.0",
"php-array-reader": "2.1.4",
- "postcss": "8.5.19",
+ "postcss": "8.5.33",
"prettier": "npm:wp-prettier@3.0.3",
- "qunit": "~2.26.0",
+ "qunit": "3.0.0",
"react-refresh": "0.14.0",
- "sass": "1.101.0",
+ "sass": "1.108.2",
"sinon": "16.1.3",
"sinon-test": "~3.1.6",
"source-map-loader": "5.0.0",
"typescript": "6.0.3",
- "update-browserslist-db": "1.3.1",
- "wait-on": "9.0.10",
- "webpack": "5.108.4"
+ "update-browserslist-db": "1.4.0",
+ "wait-on": "9.5.1",
+ "webpack": "5.109.2"
},
"engines": {
"node": ">=24.18.0",
@@ -2708,9 +2708,9 @@
"license": "BSD-3-Clause"
},
"node_modules/@hapi/tlds": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/@hapi/tlds/-/tlds-1.1.4.tgz",
- "integrity": "sha512-Fq+20dxsxLaUn5jSSWrdtSRcIUba2JquuorF9UW1wIJS5cSUwxIsO2GIhaWynPRflvxSzFN+gxKte2HEW1OuoA==",
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/@hapi/tlds/-/tlds-1.1.7.tgz",
+ "integrity": "sha512-MgNjRwy9Ti92yVAixLmDc8dd1bJIKwO9qlWCfFQRwRmUEDPQHYn4G6hwPFvFGUTzAa0FsS+inMjLin7GnyBRhA==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
@@ -4028,9 +4028,9 @@
}
},
"node_modules/@napi-rs/image": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image/-/image-1.14.0.tgz",
- "integrity": "sha512-pmwJPWY6R063luNBEP9msq9lFu+kYVMiQTJRSpyGnzYnnerYpT3U4vCgFhhVR3jypCgCVWi9viDLoEJoZoIA1w==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image/-/image-1.16.0.tgz",
+ "integrity": "sha512-kciiEskvG7m6t0+VwJ/dUT5Zn79mKr1/RAAmjvG8TfK6aG9dI1lZqohtt8QGSQjdhRkyYJ85YKW686gQGFgzWw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -4041,25 +4041,24 @@
"url": "https://github.com/sponsors/Brooooooklyn"
},
"optionalDependencies": {
- "@napi-rs/image-android-arm64": "1.14.0",
- "@napi-rs/image-darwin-arm64": "1.14.0",
- "@napi-rs/image-darwin-x64": "1.14.0",
- "@napi-rs/image-freebsd-x64": "1.14.0",
- "@napi-rs/image-linux-arm-gnueabihf": "1.14.0",
- "@napi-rs/image-linux-arm64-gnu": "1.14.0",
- "@napi-rs/image-linux-arm64-musl": "1.14.0",
- "@napi-rs/image-linux-x64-gnu": "1.14.0",
- "@napi-rs/image-linux-x64-musl": "1.14.0",
- "@napi-rs/image-wasm32-wasi": "1.14.0",
- "@napi-rs/image-win32-arm64-msvc": "1.14.0",
- "@napi-rs/image-win32-ia32-msvc": "1.14.0",
- "@napi-rs/image-win32-x64-msvc": "1.14.0"
+ "@napi-rs/image-android-arm64": "1.16.0",
+ "@napi-rs/image-darwin-arm64": "1.16.0",
+ "@napi-rs/image-darwin-x64": "1.16.0",
+ "@napi-rs/image-freebsd-x64": "1.16.0",
+ "@napi-rs/image-linux-arm-gnueabihf": "1.16.0",
+ "@napi-rs/image-linux-arm64-gnu": "1.16.0",
+ "@napi-rs/image-linux-arm64-musl": "1.16.0",
+ "@napi-rs/image-linux-x64-gnu": "1.16.0",
+ "@napi-rs/image-linux-x64-musl": "1.16.0",
+ "@napi-rs/image-win32-arm64-msvc": "1.16.0",
+ "@napi-rs/image-win32-ia32-msvc": "1.16.0",
+ "@napi-rs/image-win32-x64-msvc": "1.16.0"
}
},
"node_modules/@napi-rs/image-android-arm64": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-android-arm64/-/image-android-arm64-1.14.0.tgz",
- "integrity": "sha512-LBWu1fNR7uC6kNQy+axDqXKU7Kj1x3UdD3xGKw/bks6YAUG15m92qwSwINDEB4Jqgl29vCeSNFItJZRm3byfJQ==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-android-arm64/-/image-android-arm64-1.16.0.tgz",
+ "integrity": "sha512-pwn/41RoGaE0gHlJBvEIikYXASeiHhs1lyo5+fWZZSXsS9hpJt0zQqWiSr7cCdCwLdg84pQwPbqd32Kp+scLSw==",
"cpu": [
"arm64"
],
@@ -4074,9 +4073,9 @@
}
},
"node_modules/@napi-rs/image-darwin-arm64": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-darwin-arm64/-/image-darwin-arm64-1.14.0.tgz",
- "integrity": "sha512-0f7SqjtXHelxbwkqdpUb/5yhVK7ciVoe902hqCeffhAFsJA7HQbEbzfM8W1MDawI6Ghenr5zHYQimWf1W1vaow==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-darwin-arm64/-/image-darwin-arm64-1.16.0.tgz",
+ "integrity": "sha512-JJesjwlmWA9m0iN4y0GvHpfZkgAviU4Yhk+qvV+D44obYPisqAhJdMCQMY1/u8Yj/PblijimCMY05fMRvCmrdQ==",
"cpu": [
"arm64"
],
@@ -4091,9 +4090,9 @@
}
},
"node_modules/@napi-rs/image-darwin-x64": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-darwin-x64/-/image-darwin-x64-1.14.0.tgz",
- "integrity": "sha512-wi6w06N516QzSd/QMre/Ye92mA4b5E2yQfr1+Hhml3tWrIM2Po2QvxBO9ns0AaG8u6y8b545bDzQCGLTfBykyQ==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-darwin-x64/-/image-darwin-x64-1.16.0.tgz",
+ "integrity": "sha512-EV/SHAnsIoadlJdyeSVtHo2RE+N6BAWTK6S3y52vvCF8/s3z38fe9o1tbk40xxPpcSXdu+gh6ASBeFHic2/NOQ==",
"cpu": [
"x64"
],
@@ -4108,9 +4107,9 @@
}
},
"node_modules/@napi-rs/image-freebsd-x64": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-freebsd-x64/-/image-freebsd-x64-1.14.0.tgz",
- "integrity": "sha512-Sz1XSGF6/Xmjb33CbWLOb7h6+ekmoJRGsN0bdnzn8W86OHPTSsIbTOMtqp9ZXTLQNJgeXQhprQhhmRFNRqq0Gg==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-freebsd-x64/-/image-freebsd-x64-1.16.0.tgz",
+ "integrity": "sha512-2Q2XcPqeFfr5U8oL9zwZgbnfJLvFrA85+XPaOgjaUiIhEFfRKDgp5l7R0jDFZvymCw0ljMKtVzUD+Id2LUQasg==",
"cpu": [
"x64"
],
@@ -4125,9 +4124,9 @@
}
},
"node_modules/@napi-rs/image-linux-arm-gnueabihf": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-arm-gnueabihf/-/image-linux-arm-gnueabihf-1.14.0.tgz",
- "integrity": "sha512-ZsJ+0Rl3Ke1DN+W4lQMSzsfrwskjP4CkUsqOT7Y/HpziwirQn9R2fl2QU2Kb2eDSQvwSvGbRCkMLqH+4V4rzHg==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-arm-gnueabihf/-/image-linux-arm-gnueabihf-1.16.0.tgz",
+ "integrity": "sha512-qOXhoEXK66U396sBtL1wDvho4yooW6EPse0Ue23kRHlRHbR6SiDKz6mKcEoB1MrQzZGeKOYRh2F9rk0iHlsPiw==",
"cpu": [
"arm"
],
@@ -4142,9 +4141,9 @@
}
},
"node_modules/@napi-rs/image-linux-arm64-gnu": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-arm64-gnu/-/image-linux-arm64-gnu-1.14.0.tgz",
- "integrity": "sha512-J06fGFXt76fAGEaCb3uyPQgZrwvGbpYZycA4Xz6F5dauVgcLPw75syXmggode5G+a0cSg40fjddXMvSWhPwHGQ==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-arm64-gnu/-/image-linux-arm64-gnu-1.16.0.tgz",
+ "integrity": "sha512-S0j/r3ciH+WW/NnsOaLwhol0wly0x0YtljZnfQ4o1YCfkVrcAPMQGgGmPyjKIG/TLQ8tqPd6liuUL4Nms017lA==",
"cpu": [
"arm64"
],
@@ -4162,9 +4161,9 @@
}
},
"node_modules/@napi-rs/image-linux-arm64-musl": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-arm64-musl/-/image-linux-arm64-musl-1.14.0.tgz",
- "integrity": "sha512-AH8WvQb58ix9/RHB+9XNF2rOB8aAnFHzj0hDCCZCplRGHmv9BzOtA+IWdf5l4f7KmEJUohY+MxVWJ1jfpgn+JQ==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-arm64-musl/-/image-linux-arm64-musl-1.16.0.tgz",
+ "integrity": "sha512-ILcos5cDYUQw6h2aty8BBlm5B4l4I5y52i0tSSU44HBM8tmGE6sUU1DREPfMx1NLhB2HX4xu1Y9DNQq7tIXhpQ==",
"cpu": [
"arm64"
],
@@ -4182,9 +4181,9 @@
}
},
"node_modules/@napi-rs/image-linux-x64-gnu": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-x64-gnu/-/image-linux-x64-gnu-1.14.0.tgz",
- "integrity": "sha512-oU3wnQcDeZf+t8vyKMP4A6okY7JNjRbiiC7j8UsJ2lDf0no3GDQEJCCFDrQ7gCKQZAI7cr0rFbI75l2KlTM0PQ==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-x64-gnu/-/image-linux-x64-gnu-1.16.0.tgz",
+ "integrity": "sha512-R2LnMJzHxztTYyySZnyWIiZmDxgK7pq8DWYT1jAuryCXcGmhUhM14BgEnQKj5h3zvDVbtf1czm6DSD9f8PDl4g==",
"cpu": [
"x64"
],
@@ -4202,9 +4201,9 @@
}
},
"node_modules/@napi-rs/image-linux-x64-musl": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-x64-musl/-/image-linux-x64-musl-1.14.0.tgz",
- "integrity": "sha512-iuDTfVmFm9W6S4gzLNdSFt+Wr86LtciJJ+u2i0KBixpFYoHzeIkUr6LHBIkYg3eNdi7xHBb9qFBvxxhFQg4tUQ==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-linux-x64-musl/-/image-linux-x64-musl-1.16.0.tgz",
+ "integrity": "sha512-UXcwFSIEEHia8/JhJO6H3uehQmTrsG8UK8tpD1qpzi8WHxUVgLJyuoVS3zKm8cmqlYq0No1cyqU6h2OnArShOw==",
"cpu": [
"x64"
],
@@ -4221,63 +4220,10 @@
"node": ">= 10"
}
},
- "node_modules/@napi-rs/image-wasm32-wasi": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-wasm32-wasi/-/image-wasm32-wasi-1.14.0.tgz",
- "integrity": "sha512-XRAbAQVWSm4wQzYwnTtOHD+ev6dRHUxLxmFQe5Nbev12dspqkB40zsDJ/yr4VwnV80gIfEfg7BvRLw9FFvLRlg==",
- "cpu": [
- "wasm32"
- ],
- "dev": true,
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "@emnapi/core": "1.11.1",
- "@emnapi/runtime": "1.11.1",
- "@napi-rs/wasm-runtime": "^1.1.6"
- },
- "engines": {
- "node": ">=14.0.0"
- }
- },
- "node_modules/@napi-rs/image-wasm32-wasi/node_modules/@emnapi/core": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz",
- "integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==",
- "dev": true,
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "@emnapi/wasi-threads": "1.2.2",
- "tslib": "^2.4.0"
- }
- },
- "node_modules/@napi-rs/image-wasm32-wasi/node_modules/@emnapi/runtime": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz",
- "integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==",
- "dev": true,
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "tslib": "^2.4.0"
- }
- },
- "node_modules/@napi-rs/image-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
- "version": "1.2.2",
- "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
- "integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
- "dev": true,
- "license": "MIT",
- "optional": true,
- "dependencies": {
- "tslib": "^2.4.0"
- }
- },
"node_modules/@napi-rs/image-win32-arm64-msvc": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-win32-arm64-msvc/-/image-win32-arm64-msvc-1.14.0.tgz",
- "integrity": "sha512-Wuq0AfN5rjrv2SkJTubIIYW//B5aBloPxND9GxRHKgGkLhyiSxBD6iOCQA1M/n12rvF9BWeadDDO8JLoO3iRHA==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-win32-arm64-msvc/-/image-win32-arm64-msvc-1.16.0.tgz",
+ "integrity": "sha512-C1lmWAajIqkiYyVb0aBz0svCWIbzFAT6YpNoQ/QC/QsyNaQ602WSLSoq4ixnNhBPQrlro/Va3n/KANv4iqp4GA==",
"cpu": [
"arm64"
],
@@ -4292,9 +4238,9 @@
}
},
"node_modules/@napi-rs/image-win32-ia32-msvc": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-win32-ia32-msvc/-/image-win32-ia32-msvc-1.14.0.tgz",
- "integrity": "sha512-Idb+OyISq24YRdO8iU+BC6QaN4pU6HpC+SRrxFOftWJg0xXPzfPfpwpwdviduJK/SjJcHe02nhUq3HKHtUEnWQ==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-win32-ia32-msvc/-/image-win32-ia32-msvc-1.16.0.tgz",
+ "integrity": "sha512-j6OMycTmw47pY4m3yw4FnurkikzA8r36xgtbHqxsXWg1TGdY2uQq37Or56USNjLIeA6Oyv4az5YXc7L1oVv03w==",
"cpu": [
"ia32"
],
@@ -4309,9 +4255,9 @@
}
},
"node_modules/@napi-rs/image-win32-x64-msvc": {
- "version": "1.14.0",
- "resolved": "https://registry.npmjs.org/@napi-rs/image-win32-x64-msvc/-/image-win32-x64-msvc-1.14.0.tgz",
- "integrity": "sha512-Hq5BY3+FeNehRe1VPhVQ28dGTSWlxnGAHeoF7/GpgeWBfltLT5+DpkV+FPyq6ju49kG1aFofE+IlSGi5sMJ0Kw==",
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/@napi-rs/image-win32-x64-msvc/-/image-win32-x64-msvc-1.16.0.tgz",
+ "integrity": "sha512-jdmbjZhvR1T++hTZpi5CYASA+2Js9tuUQGtQ0fVtrtbGt82sGkYrrax8gAVNsgyvEu9/B2yxbB/4mlJcXkwt0Q==",
"cpu": [
"x64"
],
@@ -4737,13 +4683,13 @@
}
},
"node_modules/@playwright/test": {
- "version": "1.64.1",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.64.1.tgz",
- "integrity": "sha512-IaYGml/nSOiZWROfPtuIL7neuu9qDOZ3TNvNljUIrhDMxiGTgPjzj/g9p9RxpS2tSepPDRY+UwAaEeiKtUvIAg==",
+ "version": "1.65.1",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.65.1.tgz",
+ "integrity": "sha512-y+NCIRm2LvY4slUVWvGh1nujJ8RF/hEisIsq2mtUPgdQC4L701bq5hZGMhrpeXjACvwvO9tj5dJqhvM6TP9lbw==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
- "playwright": "1.64.1"
+ "playwright": "1.65.1"
},
"bin": {
"playwright": "cli.js"
@@ -4753,9 +4699,9 @@
}
},
"node_modules/@pmmmwh/react-refresh-webpack-plugin": {
- "version": "0.6.2",
- "resolved": "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.6.2.tgz",
- "integrity": "sha512-IhIAD5n4XvGHuL9nAgWfsBR0TdxtjrUWETYKCBHxauYXEv+b+ctEbs9neEgPC7Ecgzv4bpZTBwesAoGDeFymzA==",
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.6.3.tgz",
+ "integrity": "sha512-k1EEmFS9K7685tqJM55DCA3sYlTNZb7aFj1M3HNFwMqH+fGgMEvemIQ5kurIzKc9wYRSmfKpSZN3WUyY/GHlvg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4775,7 +4721,7 @@
"sockjs-client": "^1.4.0",
"type-fest": ">=0.17.0 <6.0.0",
"webpack": "^5.0.0",
- "webpack-dev-server": "^4.8.0 || 5.x",
+ "webpack-dev-server": "^4.8.0 || 5.x || 6.x",
"webpack-hot-middleware": "2.x",
"webpack-plugin-serve": "1.x"
},
@@ -5754,9 +5700,9 @@
}
},
"node_modules/@types/codemirror": {
- "version": "5.60.17",
- "resolved": "https://registry.npmjs.org/@types/codemirror/-/codemirror-5.60.17.tgz",
- "integrity": "sha512-AZq2FIsUHVMlp7VSe2hTfl5w4pcUkoFkM3zVsRKsn1ca8CXRDYvnin04+HP2REkwsxemuHqvDofdlhUWNpbwfw==",
+ "version": "5.60.18",
+ "resolved": "https://registry.npmjs.org/@types/codemirror/-/codemirror-5.60.18.tgz",
+ "integrity": "sha512-aSBOPXH2PXRYixxUpVP1sJ5+S0vEfKDvR+lABZ7Kju/9Qb0SSbZk72NihWaKoQbANyibs92q4DBfYasywxnNkA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -5979,13 +5925,13 @@
"license": "MIT"
},
"node_modules/@types/node": {
- "version": "20.19.43",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz",
- "integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==",
+ "version": "24.19.2",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz",
+ "integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "undici-types": "~6.21.0"
+ "undici-types": ">=7.24.0 <7.24.7"
}
},
"node_modules/@types/node-forge": {
@@ -8671,19 +8617,6 @@
"node": ">=0.4.0"
}
},
- "node_modules/acorn-import-phases": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz",
- "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=10.13.0"
- },
- "peerDependencies": {
- "acorn": "^8.14.0"
- }
- },
"node_modules/acorn-jsx": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
@@ -9189,9 +9122,9 @@
"dev": true
},
"node_modules/autoprefixer": {
- "version": "10.5.3",
- "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.5.3.tgz",
- "integrity": "sha512-bJRzflk8GgE4JX+iZNEwz9f9p460NCHnU7bd+CZ9vIjIlZuTkt6F3WSl2oNO8StZBFx17nLEsiQ6H2wcZiY7nA==",
+ "version": "10.6.2",
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.6.2.tgz",
+ "integrity": "sha512-VOw9/yGTGwPPgzFcODtcv6zhEPIeIWkRSe10L2ri2f5vZ7ID7lCt6jZzRF5/ubgOZ+szYydmEF5AYsA5jxX1tA==",
"dev": true,
"funding": [
{
@@ -9209,8 +9142,8 @@
],
"license": "MIT",
"dependencies": {
- "browserslist": "^4.28.6",
- "caniuse-lite": "^1.0.30001805",
+ "browserslist": "^4.28.9",
+ "caniuse-lite": "^1.0.30001810",
"fraction.js": "^5.3.4",
"picocolors": "^1.1.1",
"postcss-value-parser": "^4.2.0"
@@ -9265,14 +9198,14 @@
}
},
"node_modules/axios": {
- "version": "1.18.1",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.1.tgz",
- "integrity": "sha512-3nTvFlvpn9Zu/RkHUqtc7/+al4UpRW5az71ap5zccp6e8RAYEzhMTecX8Dz1wWDYrPpUoB1HAQEGEAEvUr7S9g==",
+ "version": "1.21.1",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.21.1.tgz",
+ "integrity": "sha512-6eI5Q/Y4u/Um9dDlsRoq5pY2rxnUTv+L4PpLitnbk/i4jb3MxLZ5CsN5Ih3IysbeRYK4pR+P7qfMsOQl9fwwFQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "follow-redirects": "^1.16.0",
- "form-data": "^4.0.5",
+ "follow-redirects": "^1.16.2",
+ "form-data": "^4.0.6",
"https-proxy-agent": "^5.0.1",
"proxy-from-env": "^2.1.0"
}
@@ -9759,9 +9692,9 @@
]
},
"node_modules/baseline-browser-mapping": {
- "version": "2.10.43",
- "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.43.tgz",
- "integrity": "sha512-AjYpR78kDWAY3Efj+cDTFH9t9SCoL7OoTp1BOb0mQV7S+6CiLwnWM3FyxhJtdPufDFKzmCSFoUncKjWgJEZTCQ==",
+ "version": "2.11.37",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.37.tgz",
+ "integrity": "sha512-QYph+vfurmaxhNwi9FprfmtkT5cx2Keg8FzZ0vnjO8ukscIybVyZGMFwdllKGlTI6qyU8ck43OM9UXh+IFJihQ==",
"dev": true,
"license": "Apache-2.0",
"bin": {
@@ -9951,9 +9884,9 @@
}
},
"node_modules/browserslist": {
- "version": "4.28.6",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.6.tgz",
- "integrity": "sha512-FQBYNK15VMslhLHpA7+n+n1GOlF1kId2xcCg7/j95f24AOF6VDYMNH4mFxF7KuaTdv627faazpOAjFzMrfJOUw==",
+ "version": "4.29.6",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.6.tgz",
+ "integrity": "sha512-CmVVIQ3RVc5HxYEc9X84GvxK/C8C1wH8TlKAiO7uTxF8PDwt7r8t9Qk3J9NkMOVzX5O/HbLv3yzxZg9HPrnI9w==",
"dev": true,
"funding": [
{
@@ -9971,11 +9904,11 @@
],
"license": "MIT",
"dependencies": {
- "baseline-browser-mapping": "^2.10.42",
- "caniuse-lite": "^1.0.30001803",
- "electron-to-chromium": "^1.5.389",
- "node-releases": "^2.0.51",
- "update-browserslist-db": "^1.2.3"
+ "baseline-browser-mapping": "^2.11.37",
+ "caniuse-lite": "^1.0.30001826",
+ "electron-to-chromium": "^1.5.486",
+ "node-releases": "^2.0.64",
+ "update-browserslist-db": "^1.4.0"
},
"bin": {
"browserslist": "cli.js"
@@ -10166,9 +10099,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001805",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001805.tgz",
- "integrity": "sha512-52noaS3DubycKSXaU30TwPGIp+POyQSUVa5jBEq3vkRkY0kjyb3LQgvhU6WGyCcyXqVLWO0Cw0Q6BSdD0kUfVA==",
+ "version": "1.0.30001826",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001826.tgz",
+ "integrity": "sha512-wTB+9tIbLro/BCXwLuNV1meHE4L9dS6dArMDwgYfNBPMYScqClHyGunhkCSDtHhe/69Xl0sHlKgBVZ+fNsYtWA==",
"dev": true,
"funding": [
{
@@ -11914,9 +11847,9 @@
"license": "MIT"
},
"node_modules/electron-to-chromium": {
- "version": "1.5.389",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.389.tgz",
- "integrity": "sha512-cEto7aeOqBfU1D+c5py5pE+ooscKE75JifxLBdFUZsqAxRS6y7kebtxAZvICszSl05gPjYHDTjY+lXpyGvpJbg==",
+ "version": "1.5.486",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.486.tgz",
+ "integrity": "sha512-rpybw4Ac4ak/An6G1Me2+61xzwobowDGyuJe71QHHOVpkZv4fPVobsLl7WH6zHSKusAMpaHxGKTpOvpy7+r3dQ==",
"dev": true,
"license": "ISC"
},
@@ -11986,9 +11919,9 @@
}
},
"node_modules/enhanced-resolve": {
- "version": "5.24.2",
- "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.24.2.tgz",
- "integrity": "sha512-rpsZEGT1jFuve6QlpyRp9ckQ+kN61hvF9BzCPyMdaKTm8UJce96KBn3sorXOFXlzjPrs3Vc4T1NsSroZ3PxlFw==",
+ "version": "5.27.0",
+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.27.0.tgz",
+ "integrity": "sha512-Do6BB2xzlcc/odFg+XEYyneAx4T/WfywO71yw9ePS2tVfRsf7JVR4mUeELadIeHzixkzbG5DpluiEFPi2WGfYQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -13964,9 +13897,9 @@
"license": "ISC"
},
"node_modules/follow-redirects": {
- "version": "1.16.0",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
- "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==",
+ "version": "1.16.3",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.3.tgz",
+ "integrity": "sha512-toOSoqN6d51Wjf1aOFJYcoVv1aND9rj/CwjLU0Vz40oDuSpWDayCeKe4JpL5NL0WdFvoOOCI3BRo69HahjbR1A==",
"dev": true,
"funding": [
{
@@ -14512,9 +14445,9 @@
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="
},
"node_modules/grunt": {
- "version": "1.6.2",
- "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.6.2.tgz",
- "integrity": "sha512-bUzh5nA/P5L66ihXTDP6J5BGnMB/8lXJXejYWSbH4Y4TvWM9t2S39sggQDYYQlx06cYcCsmu63HMYHGCIzUVfg==",
+ "version": "1.6.3",
+ "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.6.3.tgz",
+ "integrity": "sha512-ng0CbpyNp/ox5e5CBY9TkZgVdAL4wK+nBHO6rNE8cXGa5kM++Lxlp0MpFBVZbpgOR2oCp/91V+T3CZVSWWLqMA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -14528,7 +14461,7 @@
"grunt-legacy-log": "~3.0.0",
"grunt-legacy-util": "~2.0.1",
"iconv-lite": "~0.6.3",
- "js-yaml": "~3.14.0",
+ "js-yaml": "^3.15.0",
"minimatch": "^3.1.5",
"nopt": "^5.0.0"
},
@@ -15443,9 +15376,9 @@
}
},
"node_modules/grunt-webpack": {
- "version": "7.0.1",
- "resolved": "https://registry.npmjs.org/grunt-webpack/-/grunt-webpack-7.0.1.tgz",
- "integrity": "sha512-3Mo0UfZE7v5CnSCIkN6tGMlKDOCr0okvk8SQrL9X/6JhrE2sQlGwFEI5Q6j89rZ9DTl9jEjkIev/hfR0x85wKg==",
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/grunt-webpack/-/grunt-webpack-8.0.0.tgz",
+ "integrity": "sha512-pcDVu1DPcDaEik29MDwMPuYwYCYW2Xhoze9UjWGGVJLK7XR/dpQ6kCwT3IDqByrVhDwobtKqFtk3b7l75OiJcw==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -15453,11 +15386,7 @@
"webpack-merge": "^6.0.1"
},
"engines": {
- "node": ">=18.19.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/webpack"
+ "node": "^22.13.0 || >=24"
},
"peerDependencies": {
"webpack": "^5.0.0"
@@ -19377,9 +19306,9 @@
}
},
"node_modules/joi": {
- "version": "18.2.3",
- "resolved": "https://registry.npmjs.org/joi/-/joi-18.2.3.tgz",
- "integrity": "sha512-N5A3KTWQpPWT4ExxxPlUx7WmykGXRzhNidWhV41d6Abu9YfI2NyWCJuxdPnslJCPWtbRpSVOWSnSS6GakLM/Rg==",
+ "version": "18.3.2",
+ "resolved": "https://registry.npmjs.org/joi/-/joi-18.3.2.tgz",
+ "integrity": "sha512-iUivApKYw5GpZmq2Sy6El99j7noo8QSUFZlyQtr3HCkosC/b5wKF6/Y3teiHIlaM8WI38sAT3P+51rB0lhAhJA==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
@@ -19458,9 +19387,9 @@
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
},
"node_modules/js-yaml": {
- "version": "3.14.2",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
- "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
+ "version": "3.15.2",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.2.tgz",
+ "integrity": "sha512-6EuL879VkRA+1Cz578mKMiKvjPNEuk6+r1JaFzoSWejZmtf7xWbIyw1e3KkxlkzTIt9Taw6JBhEppG7utc1P+w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -20174,20 +20103,6 @@
"uc.micro": "^1.0.1"
}
},
- "node_modules/loader-runner": {
- "version": "4.3.2",
- "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.2.tgz",
- "integrity": "sha512-DFEqQ3ihfS9blba08cLfYf1NRAIEm+dDjic073DRDc3/JspI/8wYmtDsHwd3+4hwvdxSK7PGaElfTmm0awWJ4w==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=6.11.5"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/webpack"
- }
- },
"node_modules/loader-utils": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
@@ -21043,16 +20958,15 @@
}
},
"node_modules/minimizer-webpack-plugin": {
- "version": "5.6.1",
- "resolved": "https://registry.npmjs.org/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.6.1.tgz",
- "integrity": "sha512-DoeAZz8Q1C1znwsUzej1fdoi4jCf7/+Em27ouLqfK/+3m8G+D7yDhUwrc3CNhjSzGUN1kn7Iv4sWmjflQHenpw==",
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.14.0.tgz",
+ "integrity": "sha512-PnvQXCJxhgH2ZVVO7Lj0sM6q8L1XGxnUvd8wVQIRwi8khMCLq5wg0Ngxe44bcuZL2FSN81RdVE7YHEVzTKsQDQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@jridgewell/trace-mapping": "^0.3.25",
"jest-worker": "^27.4.5",
- "schema-utils": "^4.3.0",
- "terser": "^5.31.1"
+ "schema-utils": "^4.6.0",
+ "terser": "^5.51.0"
},
"engines": {
"node": ">= 10.13.0"
@@ -21068,6 +20982,9 @@
"@minify-html/node": {
"optional": true
},
+ "@napi-rs/image": {
+ "optional": true
+ },
"@swc/core": {
"optional": true
},
@@ -21092,12 +21009,21 @@
"html-minifier-terser": {
"optional": true
},
+ "imagemin": {
+ "optional": true
+ },
"lightningcss": {
"optional": true
},
"postcss": {
"optional": true
},
+ "sharp": {
+ "optional": true
+ },
+ "svgo": {
+ "optional": true
+ },
"uglify-js": {
"optional": true
}
@@ -21120,6 +21046,24 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
+ "node_modules/minimizer-webpack-plugin/node_modules/ajv-formats": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz",
+ "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "ajv": {
+ "optional": true
+ }
+ }
+ },
"node_modules/minimizer-webpack-plugin/node_modules/ajv-keywords": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz",
@@ -21141,23 +21085,34 @@
"license": "MIT"
},
"node_modules/minimizer-webpack-plugin/node_modules/schema-utils": {
- "version": "4.3.3",
- "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz",
- "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==",
+ "version": "4.8.3",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.8.3.tgz",
+ "integrity": "sha512-qIfo3f+lRNqnMPgpXSKvUhsT3pY5U+ppmgGr4j8LanFP3W/Ze+xj8DY/dPb5qVu3m6qFIMyMWKVRLNKxrNhxWg==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@types/json-schema": "^7.0.9",
- "ajv": "^8.9.0",
- "ajv-formats": "^2.1.1",
+ "@types/json-schema": "^7.0.15",
+ "ajv": "^8.20.0",
+ "ajv-formats": "^3.0.1",
"ajv-keywords": "^5.1.0"
},
+ "bin": {
+ "schema-utils": "bin/schema-utils.js"
+ },
"engines": {
"node": ">= 10.13.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
+ },
+ "peerDependencies": {
+ "webpack": "^5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "webpack": {
+ "optional": true
+ }
}
},
"node_modules/minipass": {
@@ -21247,9 +21202,9 @@
"dev": true
},
"node_modules/nanoid": {
- "version": "3.3.16",
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz",
- "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==",
+ "version": "3.3.20",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
"dev": true,
"funding": [
{
@@ -21430,9 +21385,9 @@
"dev": true
},
"node_modules/node-releases": {
- "version": "2.0.51",
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.51.tgz",
- "integrity": "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==",
+ "version": "2.0.64",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.64.tgz",
+ "integrity": "sha512-zAPCKqMcnqs2nGy6nlkm7JduFseiBJy3EXHGLh+8pFR+TxGCBxxiEN21+UROU5CKwX/f4TlUcYjiM+vs/tsyxw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -21488,10 +21443,11 @@
}
},
"node_modules/node-watch": {
- "version": "0.7.3",
- "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.3.tgz",
- "integrity": "sha512-3l4E8uMPY1HdMMryPRUAl+oIHtXtyiTlIiESNSVSNxcPfzAFzeTbXFQkZfAwBbo0B1qMSG8nUABx+Gd+YrbKrQ==",
+ "version": "0.7.4",
+ "resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.4.tgz",
+ "integrity": "sha512-RinNxoz4W1cep1b928fuFhvAQ5ag/+1UlMDV7rbyGthBIgsiEouS4kvRayvvboxii4m8eolKOIBo3OjDqbc+uQ==",
"dev": true,
+ "license": "MIT",
"engines": {
"node": ">=6"
}
@@ -22831,13 +22787,13 @@
}
},
"node_modules/playwright": {
- "version": "1.64.1",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.1.tgz",
- "integrity": "sha512-HCrVhHr5QQuwYoswEUGTb7gGp522yflbv/ST8nF4sFWGuLjQCt17Q/EubpGGSNKYn1tsTCPZxqHhHCfVURu7UA==",
+ "version": "1.65.1",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz",
+ "integrity": "sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
- "playwright-core": "1.64.1"
+ "playwright-core": "1.65.1"
},
"bin": {
"playwright": "cli.js"
@@ -22847,9 +22803,9 @@
}
},
"node_modules/playwright-core": {
- "version": "1.64.1",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.1.tgz",
- "integrity": "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==",
+ "version": "1.65.1",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.1.tgz",
+ "integrity": "sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
@@ -22902,9 +22858,9 @@
}
},
"node_modules/postcss": {
- "version": "8.5.19",
- "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.19.tgz",
- "integrity": "sha512-Mz8SaolMd8nB+G13WkORcxQKHZ/NE4xXevtkJHVuG+guo9/wYKlIMTKAqGdEmYOXR2ijPjTYNHssizdaVSUNdQ==",
+ "version": "8.5.33",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz",
+ "integrity": "sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==",
"dev": true,
"funding": [
{
@@ -22922,9 +22878,9 @@
],
"license": "MIT",
"dependencies": {
- "nanoid": "^3.3.12",
+ "nanoid": "^3.3.20",
"picocolors": "^1.1.1",
- "source-map-js": "^1.2.1"
+ "source-map-js": "^1.2.2"
},
"engines": {
"node": "^10 || ^12 || >=14"
@@ -23472,30 +23428,31 @@
}
},
"node_modules/qunit": {
- "version": "2.26.0",
- "resolved": "https://registry.npmjs.org/qunit/-/qunit-2.26.0.tgz",
- "integrity": "sha512-KSv16YomcYmiK90qTOJl3Bm5IvTf2upqQDdBQWCvSQWe94FWobnUgKOpvpvZdG7VkDt3TJSI8k8g9+GGGEd7Fw==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/qunit/-/qunit-3.0.0.tgz",
+ "integrity": "sha512-g4Fgw3uhqwdjzhUDa0bYGQyGzs1xRcIY/32c5zUydnnrgzcA8updYF9nIeUis+PfwuqX6UB/4JpCNMnrVBY6iA==",
"dev": true,
"license": "MIT",
"dependencies": {
- "commander": "7.2.0",
- "node-watch": "0.7.3",
+ "commander": "12.1.0",
+ "node-watch": "0.7.4",
"tiny-glob": "0.2.9"
},
"bin": {
"qunit": "bin/qunit.js"
},
"engines": {
- "node": ">=10"
+ "node": ">=18"
}
},
"node_modules/qunit/node_modules/commander": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
- "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
+ "version": "12.1.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz",
+ "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">= 10"
+ "node": ">=18"
}
},
"node_modules/randombytes": {
@@ -24318,9 +24275,9 @@
"dev": true
},
"node_modules/sass": {
- "version": "1.101.0",
- "resolved": "https://registry.npmjs.org/sass/-/sass-1.101.0.tgz",
- "integrity": "sha512-OL3GoQyoUdDt843DpVmDO6y2k1sc5IhUDSpu8XucEI+35neq5QivZ1iuegnpraEVTJXlQGK1gl27zKcTLEPbQw==",
+ "version": "1.108.2",
+ "resolved": "https://registry.npmjs.org/sass/-/sass-1.108.2.tgz",
+ "integrity": "sha512-kugK8djotnG9HQRPTOf36asKYlxg8rWWsNLYHOgWDIVOiZQqlRfKBgF4XXM6kfw146kIDMvm57B4GIkvDSyTzA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -25034,10 +24991,11 @@
}
},
"node_modules/source-map-js": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
- "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
"dev": true,
+ "license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
@@ -26211,14 +26169,14 @@
}
},
"node_modules/terser": {
- "version": "5.37.0",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.37.0.tgz",
- "integrity": "sha512-B8wRRkmre4ERucLM/uXx4MOV5cbnOlVAqUst+1+iLKPI0dOgFO28f84ptoQt9HEI537PMzfYa/d+GEPKTRXmYA==",
+ "version": "5.51.2",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.51.2.tgz",
+ "integrity": "sha512-bWnjSNscmuI+GJze6ZupnHP8G/cTcsJF+bXCeQknk2SHQsgbNJnLrqiH9jZ2W4STPVXH2mDKKRX3iwPhc9Cn/Q==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
- "acorn": "^8.8.2",
+ "acorn": "^8.15.0",
"commander": "^2.20.0",
"source-map-support": "~0.5.20"
},
@@ -26876,9 +26834,9 @@
}
},
"node_modules/undici-types": {
- "version": "6.21.0",
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
- "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
+ "version": "7.24.6",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
+ "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
"dev": true,
"license": "MIT"
},
@@ -26993,9 +26951,9 @@
}
},
"node_modules/update-browserslist-db": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.1.tgz",
- "integrity": "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.4.0.tgz",
+ "integrity": "sha512-WPJuOnjI9FWDct4fB+ej4Mz8opLaw5CDcZ2t44tFZ0vIQVYWzBhWR3mkixuUj/A7+vY4V9+ApOZ2YYLwdgq46w==",
"dev": true,
"funding": [
{
@@ -27195,16 +27153,15 @@
}
},
"node_modules/wait-on": {
- "version": "9.0.10",
- "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-9.0.10.tgz",
- "integrity": "sha512-rCoJEhvMr0X6alHmwc9abbrA5ZrLZFKpFQVKPNFwl2h7DapXOGdmimIHDtLOWhT4PjhZhxFEtZoQgEXbkDWdZw==",
+ "version": "9.5.1",
+ "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-9.5.1.tgz",
+ "integrity": "sha512-bOtj1wRY6u+GPnNskZLcgZNHOaL5NC4+5hRCbEpVoVX6MbMrCLCqIBM2bjsAfrgst3ZC0siIo7vLb4LuYFfIow==",
"dev": true,
"license": "MIT",
"dependencies": {
- "axios": "^1.16.0",
- "joi": "^18.2.1",
+ "axios": "^1.20.0",
+ "joi": "^18.2.9",
"lodash": "^4.18.1",
- "minimist": "^1.2.8",
"rxjs": "^7.8.2"
},
"bin": {
@@ -27280,9 +27237,9 @@
}
},
"node_modules/webpack": {
- "version": "5.108.4",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.108.4.tgz",
- "integrity": "sha512-yur8LyJoeiWh47dErD+Ok7vlbmDsJ3UbbRPAoxbGJ54WpE2y5yVo5G/inUzujnYgw3tPmBRdn+G7PoxXaYC33w==",
+ "version": "5.109.2",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.109.2.tgz",
+ "integrity": "sha512-U9/cvLzxObKNEZ9+TtdqrHM5/9z3lgl2c+c4BzbqGxFQvQvBAq87yql5A8pQ+rrMbS496MZJeF5enVBndIy2hw==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -27292,22 +27249,20 @@
"@webassemblyjs/wasm-edit": "^1.14.1",
"@webassemblyjs/wasm-parser": "^1.14.1",
"acorn": "^8.16.0",
- "acorn-import-phases": "^1.0.3",
"browserslist": "^4.28.1",
"chrome-trace-event": "^1.0.2",
- "enhanced-resolve": "^5.22.2",
+ "enhanced-resolve": "^5.24.4",
"es-module-lexer": "^2.1.0",
"eslint-scope": "5.1.1",
"events": "^3.2.0",
"graceful-fs": "^4.2.11",
- "loader-runner": "^4.3.2",
"mime-db": "^1.54.0",
"minimizer-webpack-plugin": "^5.6.1",
"neo-async": "^2.6.2",
"schema-utils": "^4.3.3",
"tapable": "^2.3.0",
"watchpack": "^2.5.2",
- "webpack-sources": "^3.5.0"
+ "webpack-sources": "^3.5.1"
},
"bin": {
"webpack": "bin/webpack.js"
diff --git a/package.json b/package.json
index 5011ea5452e2d..30e853bd255bd 100644
--- a/package.json
+++ b/package.json
@@ -1,13 +1,13 @@
{
"name": "WordPress",
- "version": "7.2.0",
+ "version": "7.3.0",
"description": "WordPress is open source software you can use to create a beautiful website, blog, or app.",
"repository": {
"type": "svn",
"url": "https://develop.svn.wordpress.org/trunk"
},
"gutenberg": {
- "sha": "61aba5422836aeed76a794f98d3fe0da3eb5f5d1",
+ "sha": "c5bdc7f4898ec98114cdccbe1cacec7a979b85cc",
"ghcrRepo": "WordPress/gutenberg/gutenberg-wp-develop-build"
},
"engines": {
@@ -41,24 +41,24 @@
"devDependencies": {
"@343dev/gifsicle": "1.2.0",
"@lodder/grunt-postcss": "^3.1.1",
- "@napi-rs/image": "1.14.0",
- "@playwright/test": "1.64.1",
- "@pmmmwh/react-refresh-webpack-plugin": "0.6.2",
+ "@napi-rs/image": "1.16.0",
+ "@playwright/test": "1.65.1",
+ "@pmmmwh/react-refresh-webpack-plugin": "0.6.3",
"@types/backbone": "1.4.23",
- "@types/codemirror": "5.60.17",
+ "@types/codemirror": "5.60.18",
"@types/espree": "10.1.0",
"@types/htmlhint": "1.1.5",
"@types/jquery": "3.5.34",
- "@types/node": "20.19.43",
+ "@types/node": "24.19.2",
"@types/underscore": "1.13.0",
"@wordpress/e2e-test-utils-playwright": "1.51.0",
"@wordpress/prettier-config": "4.51.0",
"@wordpress/scripts": "33.0.0",
- "autoprefixer": "10.5.3",
+ "autoprefixer": "10.6.2",
"chokidar": "4.0.3",
"dotenv": "17.4.2",
"dotenv-expand": "13.0.0",
- "grunt": "1.6.2",
+ "grunt": "1.6.3",
"grunt-banner": "^0.6.0",
"grunt-contrib-clean": "~2.0.1",
"grunt-contrib-concat": "2.1.0",
@@ -73,23 +73,23 @@
"grunt-replace-lts": "~1.1.0",
"grunt-rtlcss": "~2.0.2",
"grunt-sass": "~4.1.0",
- "grunt-webpack": "7.0.1",
+ "grunt-webpack": "8.0.0",
"install-changed": "1.1.0",
"json2php": "0.0.12",
- "minimizer-webpack-plugin": "5.6.1",
+ "minimizer-webpack-plugin": "5.14.0",
"php-array-reader": "2.1.4",
- "postcss": "8.5.19",
+ "postcss": "8.5.33",
"prettier": "npm:wp-prettier@3.0.3",
- "qunit": "~2.26.0",
+ "qunit": "3.0.0",
"react-refresh": "0.14.0",
- "sass": "1.101.0",
+ "sass": "1.108.2",
"sinon": "16.1.3",
"sinon-test": "~3.1.6",
"source-map-loader": "5.0.0",
"typescript": "6.0.3",
- "update-browserslist-db": "1.3.1",
- "wait-on": "9.0.10",
- "webpack": "5.108.4"
+ "update-browserslist-db": "1.4.0",
+ "wait-on": "9.5.1",
+ "webpack": "5.109.2"
},
"dependencies": {
"backbone": "1.6.1",
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index 9f15c0c3670d6..469f013a3a23a 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -194,6 +194,8 @@
' . __( 'At a Glance — Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '
'; } -$help .= '' . __( 'Activity — Shows upcoming scheduled posts, recently published posts, and posts published on this day in previous years.' ) . '
'; - -if ( _wp_dashboard_has_received_comments() ) { - $help .= '' . __( 'Recent Comments — Shows the most recent comments on your posts and allows you to moderate them.' ) . '
'; -} +$help .= '' . __( 'Activity — Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '
'; if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) { $help .= '' . __( "Quick Draft — Allows you to create a new post and save it as a draft. Also displays links to the 3 most recent draft posts you've started." ) . '
'; diff --git a/src/wp-admin/about.php b/src/wp-admin/about.php index 1bfc3018e0556..a2cf8c5ca1ec4 100644 --- a/src/wp-admin/about.php +++ b/src/wp-admin/about.php @@ -14,7 +14,7 @@ $title = _x( 'About', 'page title' ); list( $display_version ) = explode( '-', wp_get_wp_version() ); -$display_major_version = '7.1'; +$display_major_version = '7.2'; $release_notes_url = sprintf( /* translators: %s: WordPress version number. */ @@ -69,21 +69,21 @@ ); ?> - +
-
-
+
+
+
+
-
-
+
+
-
-
+
+
+
+
-
-
+
+
' . __( 'No activity yet!' ) . '
'; echo '' . esc_html__( 'No comments to show.' ) . '
'; - } -} - -/** - * Outputs recent comments. + * Show Comments section. * * @since 3.8.0 - * @since 7.2.0 Moved from the Activity widget to a dedicated dashboard widget. * - * @param int $total_items Optional. Number of comments to query. Default 5. - * @param bool $show_title Optional. Whether to display the section title. Default true. + * @param int $total_items Optional. Number of comments to query. Default 5. * @return bool False if no comments were found. True otherwise. */ -function wp_dashboard_recent_comments( $total_items = 5, $show_title = true ) { +function wp_dashboard_recent_comments( $total_items = 5 ) { // Select all comment types and filter out spam later for better query performance. $comments = array(); @@ -1353,10 +1128,7 @@ function wp_dashboard_recent_comments( $total_items = 5, $show_title = true ) { if ( $comments ) { echo '
' . - /* translators: 1: Featured tag editor URL, 2: Post editor URL, 3: Customizer URL, 4: Post editor URL. */ - '- ' . sprintf( __( 'The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a tag; you can change the tag and layout in Appearance → Customize. If no posts match the tag, sticky posts will be displayed instead.', 'twentyfourteen' ), esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), admin_url( 'customize.php' ), admin_url( 'edit.php?show_sticky=1' ) ) . '
' .
+ '- ' . sprintf(
+ /* translators: 1: Featured tag editor URL, 2: Post editor URL, 3: Customizer URL, 4: Post editor URL. */
+ __( 'The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a tag; you can change the tag and layout in Appearance → Customize. If no posts match the tag, sticky posts will be displayed instead.', 'twentyfourteen' ),
+ esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),
+ admin_url( 'customize.php' ),
+ admin_url( 'edit.php?show_sticky=1' )
+ ) . '
' .
/* translators: %s: Featured images documentation URL. */
'- ' . sprintf( __( 'Enhance your site design by using Featured Images for posts you’d like to stand out (also known as post thumbnails). This allows you to associate an image with your post without inserting it. Twenty Fourteen uses featured images for posts and pages—above the title—and in the Featured Content area on the home page.', 'twentyfourteen' ), 'https://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail' ) . '
' .
/* translators: %s: Twenty Fourteen documentation URL. */
diff --git a/src/wp-content/themes/twentyseventeen/single.php b/src/wp-content/themes/twentyseventeen/single.php
index 7fe1bc64891d5..406b4727b9131 100644
--- a/src/wp-content/themes/twentyseventeen/single.php
+++ b/src/wp-content/themes/twentyseventeen/single.php
@@ -30,10 +30,20 @@
the_post_navigation(
array(
- /* translators: Hidden accessibility text. */
- 'prev_text' => '' . __( 'Previous Post', 'twentyseventeen' ) . '' . __( 'Previous', 'twentyseventeen' ) . ' ' . twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '%title',
- /* translators: Hidden accessibility text. */
- 'next_text' => '' . __( 'Next Post', 'twentyseventeen' ) . '' . __( 'Next', 'twentyseventeen' ) . ' %title' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ) . '',
+ 'prev_text' => '' .
+ /* translators: Hidden accessibility text. */
+ __( 'Previous Post', 'twentyseventeen' ) .
+ '' .
+ /* translators: Visible label for the link to the previous post. */
+ __( 'Previous', 'twentyseventeen' ) .
+ ' ' . twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '%title',
+ 'next_text' => '' .
+ /* translators: Hidden accessibility text. */
+ __( 'Next Post', 'twentyseventeen' ) .
+ '' .
+ /* translators: Visible label for the link to the next post. */
+ __( 'Next', 'twentyseventeen' ) .
+ ' %title' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ) . '',
)
);
diff --git a/src/wp-content/themes/twentyten/archive.php b/src/wp-content/themes/twentyten/archive.php
index 36c5e0b3e2a39..056643232e04d 100644
--- a/src/wp-content/themes/twentyten/archive.php
+++ b/src/wp-content/themes/twentyten/archive.php
@@ -36,11 +36,17 @@
/* translators: %s: Date. */
printf( __( 'Daily Archives: %s', 'twentyten' ), get_the_date() );
} elseif ( is_month() ) {
- /* translators: %s: Date. */
- printf( __( 'Monthly Archives: %s', 'twentyten' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyten' ) ) );
+ printf(
+ /* translators: %s: Date. */
+ __( 'Monthly Archives: %s', 'twentyten' ),
+ get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyten' ) )
+ );
} elseif ( is_year() ) {
- /* translators: %s: Date. */
- printf( __( 'Yearly Archives: %s', 'twentyten' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyten' ) ) );
+ printf(
+ /* translators: %s: Date. */
+ __( 'Yearly Archives: %s', 'twentyten' ),
+ get_the_date( _x( 'Y', 'yearly archives date format', 'twentyten' ) )
+ );
} else {
_e( 'Blog Archives', 'twentyten' );
}
diff --git a/src/wp-content/themes/twentyten/images/wordpress.png b/src/wp-content/themes/twentyten/images/wordpress.png
index ac9d227805c22..bc5f40d97f0fc 100644
Binary files a/src/wp-content/themes/twentyten/images/wordpress.png and b/src/wp-content/themes/twentyten/images/wordpress.png differ
diff --git a/src/wp-content/themes/twentythirteen/archive.php b/src/wp-content/themes/twentythirteen/archive.php
index b4dc2eaa0cd22..dddf548882547 100644
--- a/src/wp-content/themes/twentythirteen/archive.php
+++ b/src/wp-content/themes/twentythirteen/archive.php
@@ -30,11 +30,17 @@
/* translators: %s: Date. */
printf( __( 'Daily Archives: %s', 'twentythirteen' ), get_the_date() );
} elseif ( is_month() ) {
- /* translators: %s: Date. */
- printf( __( 'Monthly Archives: %s', 'twentythirteen' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentythirteen' ) ) );
+ printf(
+ /* translators: %s: Date. */
+ __( 'Monthly Archives: %s', 'twentythirteen' ),
+ get_the_date( _x( 'F Y', 'monthly archives date format', 'twentythirteen' ) )
+ );
} elseif ( is_year() ) {
- /* translators: %s: Date. */
- printf( __( 'Yearly Archives: %s', 'twentythirteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentythirteen' ) ) );
+ printf(
+ /* translators: %s: Date. */
+ __( 'Yearly Archives: %s', 'twentythirteen' ),
+ get_the_date( _x( 'Y', 'yearly archives date format', 'twentythirteen' ) )
+ );
} else {
_e( 'Archives', 'twentythirteen' );
}
diff --git a/src/wp-content/themes/twentythirteen/images/search-icon-2x.png b/src/wp-content/themes/twentythirteen/images/search-icon-2x.png
index 02b63b8027efb..6903b9f9a9bb3 100644
Binary files a/src/wp-content/themes/twentythirteen/images/search-icon-2x.png and b/src/wp-content/themes/twentythirteen/images/search-icon-2x.png differ
diff --git a/src/wp-content/themes/twentythirteen/images/search-icon.png b/src/wp-content/themes/twentythirteen/images/search-icon.png
index 11d8dc8e508ef..63cc3f4791c5c 100644
Binary files a/src/wp-content/themes/twentythirteen/images/search-icon.png and b/src/wp-content/themes/twentythirteen/images/search-icon.png differ
diff --git a/src/wp-content/themes/twentytwelve/archive.php b/src/wp-content/themes/twentytwelve/archive.php
index b44a1c6c9f53c..084a15845f1ec 100644
--- a/src/wp-content/themes/twentytwelve/archive.php
+++ b/src/wp-content/themes/twentytwelve/archive.php
@@ -30,11 +30,17 @@
/* translators: %s: Date. */
printf( __( 'Daily Archives: %s', 'twentytwelve' ), '' . get_the_date() . '' );
} elseif ( is_month() ) {
- /* translators: %s: Date. */
- printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '' );
+ printf(
+ /* translators: %s: Date. */
+ __( 'Monthly Archives: %s', 'twentytwelve' ),
+ '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . ''
+ );
} elseif ( is_year() ) {
- /* translators: %s: Date. */
- printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '' );
+ printf(
+ /* translators: %s: Date. */
+ __( 'Yearly Archives: %s', 'twentytwelve' ),
+ '' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . ''
+ );
} else {
_e( 'Archives', 'twentytwelve' );
}
diff --git a/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-a.png b/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-a.png
index e89c08688f05e..6701875333217 100644
Binary files a/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-a.png and b/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-a.png differ
diff --git a/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-b.png b/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-b.png
index 00dfd88af328f..abec60558dde3 100644
Binary files a/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-b.png and b/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-b.png differ
diff --git a/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-c.png b/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-c.png
index 5cb608fbd2e6b..73ffd9365b965 100644
Binary files a/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-c.png and b/src/wp-content/themes/twentytwentytwo/assets/images/flight-path-on-transparent-c.png differ
diff --git a/src/wp-includes/abilities-api/class-wp-ability.php b/src/wp-includes/abilities-api/class-wp-ability.php
index 6903f66d66a48..3e9dc2c18fdac 100644
--- a/src/wp-includes/abilities-api/class-wp-ability.php
+++ b/src/wp-includes/abilities-api/class-wp-ability.php
@@ -682,7 +682,11 @@ public function validate_input( $input = null ) {
* override it. If default validation passed, the filter can add additional
* validation checks and return a WP_Error if those checks fail.
*
+ * During input preparation, this filter runs again with sanitized input if
+ * sanitization changes the value and completes without an error.
+ *
* @since 7.1.0
+ * @since 7.2.0 Also runs with sanitized input when sanitization changes the value.
*
* @param true|WP_Error $is_valid The validation result from default validation.
* @param mixed $input The input data being validated.
@@ -704,7 +708,8 @@ public function validate_input( $input = null ) {
* Normalizes the input, validates it against the input schema, and then sanitizes
* it. `execute()` passes the result to the permission and execute callbacks.
* Validation runs before sanitization, so sanitization cannot make invalid input
- * valid.
+ * valid. Changed input is validated again after sanitization, including the
+ * `wp_ability_validate_input` filter, before it reaches the callbacks.
*
* @since 7.2.0
*
@@ -726,7 +731,25 @@ public function prepare_input( $input = null ) {
return $is_valid;
}
- return $this->sanitize_input( $input );
+ $sanitized = $this->sanitize_input( $input );
+ if ( is_wp_error( $sanitized ) ) {
+ return $sanitized;
+ }
+
+ /*
+ * Sanitization can make valid input invalid, for example by trimming a string
+ * below its `minLength` or casting an out-of-range number to a different integer.
+ * Validate changed input again so validation filters also evaluate the value
+ * callbacks will receive.
+ */
+ if ( $sanitized !== $input ) {
+ $is_valid = $this->validate_input( $sanitized );
+ if ( is_wp_error( $is_valid ) ) {
+ return $is_valid;
+ }
+ }
+
+ return $sanitized;
}
/**
diff --git a/src/wp-includes/abilities/class-wp-abilities-content.php b/src/wp-includes/abilities/class-wp-abilities-content.php
index 17e1a81ac30df..a8d9954e30965 100644
--- a/src/wp-includes/abilities/class-wp-abilities-content.php
+++ b/src/wp-includes/abilities/class-wp-abilities-content.php
@@ -1024,6 +1024,7 @@ private function get_post_properties(): array {
),
'link' => array(
'type' => 'string',
+ 'format' => 'uri',
'description' => __( 'The permalink URL.' ),
),
'title' => array(
diff --git a/src/wp-includes/abilities/class-wp-abilities-settings.php b/src/wp-includes/abilities/class-wp-abilities-settings.php
index 3beb82570ccfe..5729103846917 100644
--- a/src/wp-includes/abilities/class-wp-abilities-settings.php
+++ b/src/wp-includes/abilities/class-wp-abilities-settings.php
@@ -220,7 +220,8 @@ private function get_settings_get_output_schema(): array {
* Reads {@see get_registered_settings()} and keeps only settings flagged with a truthy
* `show_in_abilities` argument, of a type the settings endpoint supports. Each entry is
* keyed by its exposed name and carries the underlying option name, the settings group,
- * the registered default (null when there is none), and a JSON Schema describing the value.
+ * the default (the exposure schema's default when it declares one, otherwise the registered
+ * default, or null when there is none), and a JSON Schema describing the value.
*
* Two settings exposed under the same name trigger a notice, and the later one is exposed.
*
@@ -260,10 +261,14 @@ private function get_exposed_settings(): array {
);
}
+ /*
+ * As the settings endpoint does, a default declared in the exposure schema
+ * overrides the registered default.
+ */
$settings[ $exposed_name ] = array(
'option' => $option_name,
'group' => $args['group'] ?? '',
- 'default' => $args['default'] ?? null,
+ 'default' => array_key_exists( 'default', $schema ) ? $schema['default'] : ( $args['default'] ?? null ),
'schema' => $schema,
);
}
diff --git a/src/wp-includes/abilities/class-wp-abilities-users.php b/src/wp-includes/abilities/class-wp-abilities-users.php
index a0f21de801e95..51df002dfe762 100644
--- a/src/wp-includes/abilities/class-wp-abilities-users.php
+++ b/src/wp-includes/abilities/class-wp-abilities-users.php
@@ -612,8 +612,10 @@ private function normalize_id_list( $value ): array {
* Accepts arrays and CSV strings, which it parses with wp_parse_list(), as schema
* validation does. Schema validation accepts a CSV string for an array, and only the
* REST run controller converts input to the schema types, so callers that bypass it,
- * such as a direct WP_Ability::execute() call, can pass one. Empty and duplicate
- * items need no handling here, because validation has already rejected them.
+ * such as a direct WP_Ability::execute() call, can pass one. Empty and whitespace-only
+ * strings name nothing, so they are dropped, and a list that holds only such strings
+ * comes back empty. Duplicate items need no handling here, because validation has
+ * already rejected them.
*
* @since 7.2.0
*
@@ -625,7 +627,12 @@ private function normalize_string_list( $value ): array {
return array();
}
- return array_values( array_filter( wp_parse_list( $value ), 'is_string' ) );
+ return array_values(
+ array_filter(
+ wp_parse_list( $value ),
+ static fn( $item ) => is_string( $item ) && '' !== trim( $item )
+ )
+ );
}
/**
@@ -703,7 +710,8 @@ private function get_users_query_input_schema(): array {
'minItems' => 1,
'maxItems' => self::MAX_PER_PAGE,
'items' => array(
- 'type' => 'string',
+ 'type' => 'string',
+ 'minLength' => 1,
),
'description' => __( 'Limit results to users with these slugs. If `pagination.per_page` is omitted, every matching user is returned on the first page.' ),
),
@@ -713,7 +721,8 @@ private function get_users_query_input_schema(): array {
'minItems' => 1,
'maxItems' => self::MAX_PER_PAGE,
'items' => array(
- 'type' => 'string',
+ 'type' => 'string',
+ 'minLength' => 1,
),
'description' => __( 'Limit results to users with these usernames. Requires permission to list users. If `pagination.per_page` is omitted, every matching user is returned on the first page.' ),
),
diff --git a/src/wp-includes/assets/script-loader-packages.php b/src/wp-includes/assets/script-loader-packages.php
index 9512d25d2c5ce..dca8010311142 100644
--- a/src/wp-includes/assets/script-loader-packages.php
+++ b/src/wp-includes/assets/script-loader-packages.php
@@ -105,7 +105,7 @@
'wp-url',
'wp-warning'
),
- 'version' => 'f9a3114894c529a215ac'
+ 'version' => 'e21efcc5c30f26ee0aba'
),
'block-library.js' => array(
'dependencies' => array(
@@ -151,7 +151,7 @@
'import' => 'dynamic'
)
),
- 'version' => '8118001470fde50b42fe'
+ 'version' => '9ad7f7e62e9fbecbab34'
),
'block-serialization-default-parser.js' => array(
'dependencies' => array(
@@ -282,7 +282,7 @@
'wp-url',
'wp-warning'
),
- 'version' => '089f1cc441f999d491af'
+ 'version' => '26d8066a55a711f6eed8'
),
'customize-widgets.js' => array(
'dependencies' => array(
@@ -549,7 +549,7 @@
'import' => 'static'
)
),
- 'version' => '3427e50f718f7602341b'
+ 'version' => 'c1e50b340a6f2a32176c'
),
'element.js' => array(
'dependencies' => array(
@@ -670,7 +670,7 @@
'wp-url',
'wp-warning'
),
- 'version' => 'd91937a9b82062da49eb'
+ 'version' => '5ef0448131de57454ed0'
),
'notices.js' => array(
'dependencies' => array(
diff --git a/src/wp-includes/assets/script-modules-packages.php b/src/wp-includes/assets/script-modules-packages.php
index a0560e1063778..9fcc01076e986 100644
--- a/src/wp-includes/assets/script-modules-packages.php
+++ b/src/wp-includes/assets/script-modules-packages.php
@@ -10,7 +10,7 @@
'wp-data',
'wp-i18n'
),
- 'version' => '9448bb3053516a39086d'
+ 'version' => '2dfc1cc1ffd6007eaacd'
),
'block-editor/utils/fit-text-frontend.js' => array(
'dependencies' => array(
@@ -349,7 +349,7 @@
'import' => 'static'
)
),
- 'version' => '2aa2fe44937a04cb98c7'
+ 'version' => '5a1005804ad8a5083c79'
),
'core-fields/root_site.js' => array(
'dependencies' => array(
@@ -466,7 +466,7 @@
'dependencies' => array(
),
- 'version' => 'b2185b9b3c06dcd1869d'
+ 'version' => '0c838873c424e941c437'
),
'interactivity-router/full-page.js' => array(
'dependencies' => array(
@@ -494,7 +494,7 @@
'import' => 'static'
)
),
- 'version' => 'c0110eac0afb41d3f204'
+ 'version' => '4555574d1243e79178f5'
),
'latex-to-mathml/index.js' => array(
'dependencies' => array(
diff --git a/src/wp-includes/block-editor.php b/src/wp-includes/block-editor.php
index 24bdd2f6db5db..8aa19ffe35224 100644
--- a/src/wp-includes/block-editor.php
+++ b/src/wp-includes/block-editor.php
@@ -194,21 +194,18 @@ function get_default_block_editor_settings() {
}
}
- // These styles are used if the "no theme styles" options is triggered or on
- // themes without their own editor styles.
- $default_editor_styles_file = ABSPATH . WPINC . '/css/dist/block-editor/default-editor-styles.css';
-
- static $default_editor_styles_file_contents = false;
- if ( ! $default_editor_styles_file_contents && file_exists( $default_editor_styles_file ) ) {
- $default_editor_styles_file_contents = file_get_contents( $default_editor_styles_file );
- }
-
- $default_editor_styles = array();
- if ( $default_editor_styles_file_contents ) {
- $default_editor_styles = array(
- array( 'css' => $default_editor_styles_file_contents ),
- );
- }
+ /*
+ * These styles are used when the "Use theme styles" preference is turned off
+ * and in the Customizer widgets editor.
+ *
+ * They were previously read from `css/dist/block-editor/default-editor-styles.css`,
+ * which the block editor package no longer ships.
+ */
+ $default_editor_styles = array(
+ array(
+ 'css' => 'body{font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:18px;line-height:1.5;--wp--style--block-gap:2em}p{line-height:1.8}',
+ ),
+ );
$editor_settings = array(
'alignWide' => get_theme_support( 'align-wide' ),
diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php
index ba63ddc331636..3b6ee11138000 100644
--- a/src/wp-includes/blocks.php
+++ b/src/wp-includes/blocks.php
@@ -2356,24 +2356,147 @@ function excerpt_remove_blocks( $content ) {
}
/**
- * Parses footnotes markup out of a content string,
- * and renders those appropriate for the excerpt.
+ * Removes recognized footnote reference markup from a given string.
+ *
+ * Example:
+ *
+ * $content = 'Never1 say never.';
+ * 'Never say never' === excerpt_remove_footnotes( $content );
*
* @since 6.3.0
*
- * @param string $content The content to parse.
- * @return string The parsed and filtered content.
+ * @param string $content HTML which might contain footnote references from the block editor.
+ * @return string Given input HTML without the footnote references.
*/
function excerpt_remove_footnotes( $content ) {
- if ( ! str_contains( $content, 'data-fn=' ) ) {
+ if ( ! str_contains( $content, 'data-fn' ) ) {
return $content;
}
- return preg_replace(
- '_\s*\d+\s*_',
- '',
- $content
- );
+ $processor = new class( $content ) extends WP_HTML_Tag_Processor {
+ public function is_whitespace_text_node(): bool {
+ if ( self::STATE_TEXT_NODE !== $this->parser_state ) {
+ return false;
+ }
+
+ $this->subdivide_text_appropriately();
+ return self::TEXT_IS_WHITESPACE === $this->text_node_classification;
+ }
+
+ public function get_span(): WP_HTML_Span {
+ $this->set_bookmark( 'here' );
+
+ return $this->bookmarks['here'];
+ }
+ };
+
+ $output = '';
+ $at = 0;
+ $reprocess_token = false;
+
+ while ( $reprocess_token || $processor->next_token() ) {
+ $reprocess_token = false;
+
+ // Match the opening tag.
+ if (
+ $processor->is_tag_closer() ||
+ 'SUP' !== $processor->get_tag() ||
+ null === $processor->get_attribute( 'data-fn' ) ||
+ null === $processor->get_attribute( 'class' )
+ ) {
+ continue;
+ }
+
+ $footnote_opening = $processor->get_span();
+
+ if ( ! $processor->next_token() ) {
+ break;
+ }
+
+ // Skip any whitespace-only text between the tags.
+ if ( '#text' === $processor->get_token_name() ) {
+ if ( ! $processor->is_whitespace_text_node() ) {
+ $reprocess_token = true;
+ continue;
+ }
+
+ $processor->next_token();
+ }
+
+ // Match the opening tag.
+ if (
+ $processor->is_tag_closer() ||
+ 'A' !== $processor->get_token_name() ||
+ null === $processor->get_attribute( 'href' ) ||
+ null === $processor->get_attribute( 'id' )
+ ) {
+ $reprocess_token = true;
+ continue;
+ }
+
+ // Match an all-digit text node.
+ if ( ! $processor->next_token() || '#text' !== $processor->get_token_name() ) {
+ $reprocess_token = true;
+ continue;
+ }
+
+ $footnote_number = $processor->get_modifiable_text();
+ $digit_count = strspn( $footnote_number, '0123456789' );
+ if ( 0 === $digit_count || strlen( $footnote_number ) !== $digit_count ) {
+ $reprocess_token = true;
+ continue;
+ }
+
+ // Match the closing tag.
+ if (
+ ! $processor->next_token() ||
+ 'A' !== $processor->get_token_name() ||
+ ! $processor->is_tag_closer()
+ ) {
+ $reprocess_token = true;
+ continue;
+ }
+
+ if ( ! $processor->next_token() ) {
+ break;
+ }
+
+ // Skip any whitespace-only text between the tags.
+ if ( '#text' === $processor->get_token_name() ) {
+ if ( ! $processor->is_whitespace_text_node() ) {
+ $reprocess_token = true;
+ continue;
+ }
+
+ $processor->next_token();
+ }
+
+ // Match the closing tag.
+ if (
+ 'SUP' !== $processor->get_token_name() ||
+ ! $processor->is_tag_closer()
+ ) {
+ $reprocess_token = true;
+ continue;
+ }
+
+ $footnote_closing = $processor->get_span();
+
+ // Remove the section and continue.
+ $output .= substr( $content, $at, $footnote_opening->start - $at );
+ $at = $footnote_closing->start + $footnote_closing->length;
+ }
+
+ // No footnotes were found and removed: return the original input.
+ if ( 0 === $at ) {
+ return $content;
+ }
+
+ if ( $at < strlen( $content ) ) {
+ $output .= substr( $content, $at );
+ }
+
+ return $output;
}
/**
diff --git a/src/wp-includes/blocks/comment-date.php b/src/wp-includes/blocks/comment-date.php
index 7856e132404a8..b14559b3cd336 100644
--- a/src/wp-includes/blocks/comment-date.php
+++ b/src/wp-includes/blocks/comment-date.php
@@ -37,7 +37,9 @@ function render_block_core_comment_date( $attributes, $content, $block ) {
$link = get_comment_link( $comment );
if ( ! empty( $attributes['isLink'] ) ) {
- $formatted_date = sprintf( '%2$s', esc_url( $link ), $formatted_date );
+ $formatted_date = sprintf( '%2$s', esc_url( $link ), esc_html( $formatted_date ) );
+ } else {
+ $formatted_date = esc_html( $formatted_date );
}
return sprintf(
diff --git a/src/wp-includes/bookmark.php b/src/wp-includes/bookmark.php
index e1c8a6e522a00..f8314af645f49 100644
--- a/src/wp-includes/bookmark.php
+++ b/src/wp-includes/bookmark.php
@@ -80,16 +80,15 @@ function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) {
* @param string $field The name of the data field to return.
* @param int $bookmark The bookmark ID to get field.
* @param string $context Optional. The context of how the field will be used. Default 'display'.
- * @return string|WP_Error
+ * @return mixed The sanitized field value, or an empty string if the bookmark or field does not exist.
+ *
+ * @phpstan-param 'link_id'|'link_url'|'link_name'|'link_image'|'link_target'|'link_description'|'link_visible'|'link_owner'|'link_rating'|'link_updated'|'link_rel'|'link_notes'|'link_rss'|'link_category' $field
+ * @phpstan-return ( $field is 'link_category' ? array|'' : ( $field is 'link_id'|'link_rating' ? int|'' : mixed ) )
*/
function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
$bookmark = (int) $bookmark;
$bookmark = get_bookmark( $bookmark );
- if ( is_wp_error( $bookmark ) ) {
- return $bookmark;
- }
-
if ( ! is_object( $bookmark ) ) {
return '';
}
@@ -403,6 +402,9 @@ function sanitize_bookmark( $bookmark, $context = 'display' ) {
* @param string $context How to filter the field value. Accepts 'raw', 'edit', 'db',
* 'display', 'attribute', or 'js'. Default 'display'.
* @return mixed The filtered value.
+ *
+ * @phpstan-param 'link_id'|'link_url'|'link_name'|'link_image'|'link_target'|'link_description'|'link_visible'|'link_owner'|'link_rating'|'link_updated'|'link_rel'|'link_notes'|'link_rss'|'link_category' $field
+ * @phpstan-return ($field is 'link_category' ? array : ($field is 'link_id'|'link_rating' ? int : mixed))
*/
function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) {
$int_fields = array( 'link_id', 'link_rating' );
diff --git a/src/wp-includes/build/scripts/core-fields/index.php b/src/wp-includes/build/scripts/core-fields/index.php
index 8b4b10f88233e..8d9fdc42b6dd9 100644
--- a/src/wp-includes/build/scripts/core-fields/index.php
+++ b/src/wp-includes/build/scripts/core-fields/index.php
@@ -32,7 +32,7 @@
* - `last_edited_date`, for every post type.
* - `notesCount`, for the post types whose `editor` support has the `notes`
* argument.
- * - `parent`, for the post types supporting `page-attributes`.
+ * - `parent`, for hierarchical post types supporting `page-attributes`.
* - `password`, for every post type but the design ones.
* - `ping_status`, for the post types supporting `trackbacks`.
* - `post-content-info`, for the post types supporting `editor`.
@@ -71,7 +71,7 @@ function wp_register_core_post_type_supports_fields() {
'format' => post_type_supports( $post_type, 'post-formats' ) && current_theme_supports( 'post-formats' ),
'last_edited_date' => true,
'notesCount' => is_array( $editor ) && (bool) array_filter( array_column( $editor, 'notes' ) ),
- 'parent' => post_type_supports( $post_type, 'page-attributes' ),
+ 'parent' => is_post_type_hierarchical( $post_type ) && post_type_supports( $post_type, 'page-attributes' ),
'password' => true,
'ping_status' => post_type_supports( $post_type, 'trackbacks' ),
'post-content-info' => post_type_supports( $post_type, 'editor' ),
diff --git a/src/wp-includes/build/scripts/core-fields/post_type_supports/parent/field.php b/src/wp-includes/build/scripts/core-fields/post_type_supports/parent/field.php
index d26460c976ad8..f3a04ab52ce2f 100644
--- a/src/wp-includes/build/scripts/core-fields/post_type_supports/parent/field.php
+++ b/src/wp-includes/build/scripts/core-fields/post_type_supports/parent/field.php
@@ -1,8 +1,8 @@
add_setting(
'custom_logo',
array(
- 'theme_supports' => array( 'custom-logo' ),
- 'transport' => 'postMessage',
+ 'theme_supports' => array( 'custom-logo' ),
+ 'transport' => 'postMessage',
+ 'sanitize_callback' => 'absint',
)
);
@@ -5985,7 +5986,6 @@ public function handle_load_themes_request() {
wp_send_json_success( $themes );
}
-
/**
* Callback for validating the header_textcolor value.
*
diff --git a/src/wp-includes/class-wp-customize-nav-menus.php b/src/wp-includes/class-wp-customize-nav-menus.php
index b093509f2f5c2..8df0392bf2406 100644
--- a/src/wp-includes/class-wp-customize-nav-menus.php
+++ b/src/wp-includes/class-wp-customize-nav-menus.php
@@ -1530,13 +1530,17 @@ public function filter_wp_nav_menu( $nav_menu_content, $args ) {
*
* Note that the array is expected to be pre-sorted.
*
+ * The serialized arguments are prefixed so that the resulting hash cannot
+ * collide with other `wp_hash()` values computed over serialized data.
+ *
* @since 4.3.0
+ * @since 7.1.5 The hash is now domain-separated from other hashes.
*
* @param array $args The arguments to hash.
* @return string Hashed nav menu arguments.
*/
public function hash_nav_menu_args( $args ) {
- return wp_hash( serialize( $args ) );
+ return wp_hash( 'customize_nav_menu_args|' . serialize( $args ) );
}
/**
diff --git a/src/wp-includes/class-wp-customize-setting.php b/src/wp-includes/class-wp-customize-setting.php
index 2658eb20fd02d..77a544bfbae0e 100644
--- a/src/wp-includes/class-wp-customize-setting.php
+++ b/src/wp-includes/class-wp-customize-setting.php
@@ -152,6 +152,28 @@ class WP_Customize_Setting {
*/
protected $is_multidimensional_aggregated = false;
+ /**
+ * Whether the setting is being saved.
+ *
+ * When saving, the value of an option setting is not sanitized with `sanitize_option()`
+ * by {@see WP_Customize_Setting::sanitize()} since `update_option()` sanitizes it.
+ *
+ * @since 7.1.5
+ * @var bool
+ */
+ private $is_saving = false;
+
+ /**
+ * Number of times that previewing has been suspended for each option, keyed by option name.
+ *
+ * While previewing an option is suspended, its preview filters pass through the original value.
+ *
+ * @since 7.1.5
+ * @see WP_Customize_Setting::suspend_option_preview()
+ * @var array
+ */
+ private static $suspended_option_previews = array();
+
/**
* Constructor.
*
@@ -178,7 +200,7 @@ class WP_Customize_Setting {
* @type callable $sanitize_js_callback Callback to convert a Customize PHP setting value to a value that is
* JSON serializable.
* @type bool $dirty Whether or not the setting is initially dirty when created.
- * }
+ * }
*/
public function __construct( $manager, $id, $args = array() ) {
$keys = array_keys( get_object_vars( $this ) );
@@ -436,6 +458,62 @@ final public function _clear_aggregated_multidimensional_preview_applied_flag()
unset( self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['preview_applied_instances'][ $this->id ] );
}
+ /**
+ * Suspends previewing the setting's option, so that its preview filters pass through the original value.
+ *
+ * This is done while the option is being sanitized or saved. Every call must be paired with a call to
+ * {@see WP_Customize_Setting::resume_option_preview()}, including when an exception or error is thrown.
+ *
+ * @since 7.1.5
+ */
+ private function suspend_option_preview() {
+ /** @var string $id_base */
+ $id_base = $this->id_data['base'];
+
+ if ( ! isset( self::$suspended_option_previews[ $id_base ] ) ) {
+ self::$suspended_option_previews[ $id_base ] = 1;
+ } else {
+ ++self::$suspended_option_previews[ $id_base ];
+ }
+ }
+
+ /**
+ * Resumes previewing the setting's option, once each suspension has been resumed.
+ *
+ * @since 7.1.5
+ *
+ * @see WP_Customize_Setting::suspend_option_preview()
+ */
+ private function resume_option_preview() {
+ /** @var string $id_base */
+ $id_base = $this->id_data['base'];
+
+ if ( ! isset( self::$suspended_option_previews[ $id_base ] ) ) {
+ return;
+ }
+
+ if ( self::$suspended_option_previews[ $id_base ] > 1 ) {
+ --self::$suspended_option_previews[ $id_base ];
+ } else {
+ unset( self::$suspended_option_previews[ $id_base ] );
+ }
+ }
+
+ /**
+ * Determines whether previewing the setting's option is suspended.
+ *
+ * @since 7.1.5
+ *
+ * @see WP_Customize_Setting::suspend_option_preview()
+ *
+ * @return bool Whether previewing the option is suspended.
+ */
+ private function is_option_preview_suspended() {
+ /** @var string $id_base */
+ $id_base = $this->id_data['base'];
+ return 'option' === $this->type && isset( self::$suspended_option_previews[ $id_base ] );
+ }
+
/**
* Callback function to filter non-multidimensional theme mods and options.
*
@@ -449,7 +527,7 @@ final public function _clear_aggregated_multidimensional_preview_applied_flag()
* @return mixed New or old value.
*/
public function _preview_filter( $original ) {
- if ( ! $this->is_current_blog_previewed() ) {
+ if ( ! $this->is_current_blog_previewed() || $this->is_option_preview_suspended() ) {
return $original;
}
@@ -481,7 +559,7 @@ public function _preview_filter( $original ) {
* @return mixed New or old value.
*/
final public function _multidimensional_preview_filter( $original ) {
- if ( ! $this->is_current_blog_previewed() ) {
+ if ( ! $this->is_current_blog_previewed() || $this->is_option_preview_suspended() ) {
return $original;
}
@@ -521,27 +599,68 @@ final public function _multidimensional_preview_filter( $original ) {
* or value isn't set or is invalid.
*/
final public function save() {
- $value = $this->post_value();
-
- if ( ! $this->check_capabilities() || ! isset( $value ) ) {
- return false;
+ /*
+ * While saving an option setting, its preview filters pass through the persisted value. Otherwise,
+ * update_option() would skip the update when the new value is the same as the previewed value, and
+ * hooks which read the option while saving would get a value not sanitized with sanitize_option().
+ */
+ if ( 'option' === $this->type ) {
+ $this->suspend_option_preview();
}
- $id_base = $this->id_data['base'];
-
- /**
- * Fires when the WP_Customize_Setting::save() method is called.
- *
- * The dynamic portion of the hook name, `$id_base` refers to
- * the base slug of the setting name.
- *
- * @since 3.4.0
- *
- * @param WP_Customize_Setting $setting WP_Customize_Setting instance.
+ /*
+ * Since a `finally` block requires PHP 5.5, the state is restored in each `catch` block before
+ * rethrowing. Exceptions are caught for PHP 5, and errors such as TypeError for PHP 7+.
*/
- do_action( "customize_save_{$id_base}", $this );
+ try {
+ $this->is_saving = true;
+ $value = $this->post_value();
+ $this->is_saving = false;
+
+ if ( ! $this->check_capabilities() || ! isset( $value ) ) {
+ $this->end_saving();
+ return false;
+ }
+
+ /** @var string $id_base */
+ $id_base = $this->id_data['base'];
+
+ /**
+ * Fires when the WP_Customize_Setting::save() method is called.
+ *
+ * The dynamic portion of the hook name, `$id_base` refers to
+ * the base slug of the setting name.
+ *
+ * @since 3.4.0
+ *
+ * @param WP_Customize_Setting $setting WP_Customize_Setting instance.
+ */
+ do_action( "customize_save_{$id_base}", $this );
+
+ $this->update( $value );
+ } catch ( Exception $e ) {
+ $this->end_saving();
+ throw $e;
+ } catch ( Throwable $e ) {
+ $this->end_saving();
+ throw $e;
+ }
- $this->update( $value );
+ $this->end_saving();
+ }
+
+ /**
+ * Restores the state changed while saving the setting.
+ *
+ * @since 7.1.5
+ *
+ * @see WP_Customize_Setting::save()
+ */
+ private function end_saving() {
+ $this->is_saving = false;
+ if ( 'option' === $this->type ) {
+ $this->resume_option_preview();
+ }
}
/**
@@ -562,12 +681,12 @@ final public function post_value( $default_value = null ) {
* Sanitize an input.
*
* @since 3.4.0
+ * @since 7.1.5 The value of an option setting is additionally sanitized with `sanitize_option()`.
*
* @param string|array $value The value to sanitize.
* @return string|array|null|WP_Error Sanitized value, or `null`/`WP_Error` if invalid.
*/
public function sanitize( $value ) {
-
/**
* Filters a Customize setting value in un-slashed form.
*
@@ -576,7 +695,101 @@ public function sanitize( $value ) {
* @param mixed $value Value of the setting.
* @param WP_Customize_Setting $setting WP_Customize_Setting instance.
*/
- return apply_filters( "customize_sanitize_{$this->id}", $value, $this );
+ $value = apply_filters( "customize_sanitize_{$this->id}", $value, $this );
+
+ /*
+ * The value of an option setting is previewed via the option filters, bypassing the
+ * sanitize_option() call in update_option(). So the value is sanitized here to ensure
+ * that the previewed value is sanitized in the same way as the value which would be
+ * persisted. When saving, this is skipped since update_option() sanitizes the value.
+ */
+ if ( 'option' === $this->type && ! $this->is_saving && ! is_null( $value ) && ! is_wp_error( $value ) ) {
+ $value = $this->sanitize_option_value( $value );
+ }
+
+ return $value;
+ }
+
+ /**
+ * Sanitizes the value of an option setting with `sanitize_option()`.
+ *
+ * This applies the sanitization for core options as well as for options sanitized via the
+ * {@see 'sanitize_option_$option'} filter, such as by the `sanitize_callback` passed to
+ * `register_setting()`. The value of a multidimensional setting is sanitized as part of
+ * the root option value.
+ *
+ * Any errors added via `add_settings_error()` during sanitization are returned as a `WP_Error`.
+ *
+ * @since 7.1.5
+ *
+ * @global array|null $wp_settings_errors Storage array of errors registered during this pageload.
+ *
+ * @param mixed $value Value which has already been sanitized by the setting's sanitize callback.
+ * @return mixed|WP_Error Sanitized value, or `WP_Error` if invalid.
+ */
+ private function sanitize_option_value( $value ) {
+ global $wp_settings_errors;
+
+ /** @var string $id_base */
+ $id_base = $this->id_data['base'];
+
+ /** @var string[] $keys */
+ $keys = $this->id_data['keys'];
+
+ // Callbacks for the "sanitize_option_{$option}" filter may call add_settings_error() without checking whether it exists.
+ if ( ! function_exists( 'add_settings_error' ) ) {
+ require_once ABSPATH . 'wp-admin/includes/template.php';
+ }
+
+ if ( $this->is_multidimensional_aggregated ) {
+ $root = self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value'];
+ $value = $this->multidimensional_replace( $root, $keys, $value );
+ }
+
+ // Capture only the errors added while sanitizing, and leave the existing errors untouched.
+ $previous_settings_errors = $wp_settings_errors;
+ $previous_settings_errors_count = is_array( $wp_settings_errors ) ? count( $wp_settings_errors ) : 0;
+
+ /*
+ * While sanitizing, the preview filters for the option pass through the original value. This
+ * prevents infinite recursion when sanitize_option() calls get_option() for the same option,
+ * for example to fall back to the existing value when the value is invalid.
+ *
+ * Since a `finally` block requires PHP 5.5, the state is restored in each `catch` block before
+ * rethrowing. Exceptions are caught for PHP 5, and errors such as TypeError for PHP 7+.
+ */
+ $this->suspend_option_preview();
+ try {
+ $value = sanitize_option( $id_base, $value );
+ } catch ( Exception $e ) {
+ $this->resume_option_preview();
+ $wp_settings_errors = $previous_settings_errors;
+ throw $e;
+ } catch ( Throwable $e ) {
+ $this->resume_option_preview();
+ $wp_settings_errors = $previous_settings_errors;
+ throw $e;
+ }
+ $this->resume_option_preview();
+
+ $settings_errors = is_array( $wp_settings_errors ) ? array_slice( $wp_settings_errors, $previous_settings_errors_count ) : array();
+ $wp_settings_errors = $previous_settings_errors;
+
+ $validity = new WP_Error();
+ foreach ( $settings_errors as $settings_error ) {
+ if ( 'error' === $settings_error['type'] ) {
+ $validity->add( $settings_error['code'], $settings_error['message'] );
+ }
+ }
+ if ( array() !== $validity->get_error_codes() ) {
+ return $validity;
+ }
+
+ if ( $this->is_multidimensional_aggregated ) {
+ $value = $this->multidimensional_get( $value, $keys );
+ }
+
+ return $value;
}
/**
@@ -850,6 +1063,7 @@ final public function check_capabilities() {
* Multidimensional helper function.
*
* @since 3.4.0
+ * @since 7.1.5 When creating, a non-array value is overridden with an array at every level, not only the last.
*
* @param array $root
* @param array $keys
@@ -869,6 +1083,11 @@ final protected function multidimensional( &$root, $keys, $create = false ) {
$node = &$root;
foreach ( $keys as $key ) {
+ if ( $create && ! is_array( $node ) ) {
+ // Account for an array overriding a string or object value.
+ $node = array();
+ }
+
if ( $create && ! isset( $node[ $key ] ) ) {
$node[ $key ] = array();
}
diff --git a/src/wp-includes/class-wp-dependencies.php b/src/wp-includes/class-wp-dependencies.php
index f9aa688cca3af..204ade1d6f0f0 100644
--- a/src/wp-includes/class-wp-dependencies.php
+++ b/src/wp-includes/class-wp-dependencies.php
@@ -73,7 +73,9 @@ class WP_Dependencies {
*
* @since 2.8.0
*
- * @var (int|false)[]
+ * @var array
+ *
+ * @phpstan-var array
*/
public $groups = array();
diff --git a/src/wp-includes/class-wp-entity-fields-registry.php b/src/wp-includes/class-wp-entity-fields-registry.php
index 864828ca1c243..1cc9b629e086e 100644
--- a/src/wp-includes/class-wp-entity-fields-registry.php
+++ b/src/wp-includes/class-wp-entity-fields-registry.php
@@ -445,8 +445,12 @@ public function get_collection_fields( $directory ) {
* @param string $kind The entity kind (e.g. `postType`).
* @param string $name The entity name (e.g. `page`).
* @return array[] The list of field definitions, in registration order.
+ * Empty when the entity is invalid.
*/
public function get_registered( $kind, $name ) {
+ if ( ! $this->validate_entity( __METHOD__, $kind, $name ) ) {
+ return array();
+ }
$this->initialize();
return array_values( $this->fields[ $kind ][ $name ] ?? array() );
}
@@ -478,7 +482,8 @@ static function ( $entities ) {
* @param string $kind The entity kind (e.g. `postType`).
* @param string $name The entity name (e.g. `page`).
* @return array[] {
- * The script modules, in registration order.
+ * The script modules, in registration order. Empty when the entity
+ * is invalid.
*
* @type array ...$0 {
* @type string $id The id of the script module.
@@ -488,6 +493,9 @@ static function ( $entities ) {
* }
*/
public function get_registered_field_modules( $kind, $name ) {
+ if ( ! $this->validate_entity( __METHOD__, $kind, $name ) ) {
+ return array();
+ }
$this->initialize();
$modules = array();
foreach ( $this->field_modules[ $kind ][ $name ] ?? array() as $module => $field_ids ) {
diff --git a/src/wp-includes/class-wp-error.php b/src/wp-includes/class-wp-error.php
index d5b3dc729a0c1..c694828d84870 100644
--- a/src/wp-includes/class-wp-error.php
+++ b/src/wp-includes/class-wp-error.php
@@ -34,7 +34,7 @@ class WP_Error {
public $error_data = array();
/**
- * Stores previously added data added for error codes, oldest-to-newest by code.
+ * Stores previously added data for error codes, oldest-to-newest by code.
*
* @since 5.6.0
* @var array
diff --git a/src/wp-includes/class-wp-http-curl.php b/src/wp-includes/class-wp-http-curl.php
index 4296bf42f2b00..cb6a9ac6056c4 100644
--- a/src/wp-includes/class-wp-http-curl.php
+++ b/src/wp-includes/class-wp-http-curl.php
@@ -228,6 +228,7 @@ public function request( $url, $args = array() ) {
* plugins to handle cookies themselves.
*
* @since 2.8.0
+ * @since 7.3.0 Also fires for each request sent by {@see WP_Http::request_multiple()}.
*
* @param resource $handle The cURL handle returned by curl_init() (passed by reference).
* @param array $parsed_args The HTTP request arguments.
diff --git a/src/wp-includes/class-wp-http-requests-hooks.php b/src/wp-includes/class-wp-http-requests-hooks.php
index aac172892f293..be6341ec27ebb 100644
--- a/src/wp-includes/class-wp-http-requests-hooks.php
+++ b/src/wp-includes/class-wp-http-requests-hooks.php
@@ -53,7 +53,12 @@ public function dispatch( $hook, $parameters = array() ) {
// Handle back-compat actions.
switch ( $hook ) {
+ /**
+ * Requests fires 'curl.before_multi_add' instead of 'curl.before_send' for the
+ * requests of a batch, see {@see WP_Http::request_multiple()}.
+ */
case 'curl.before_send':
+ case 'curl.before_multi_add':
/** This action is documented in wp-includes/class-wp-http-curl.php */
do_action_ref_array( 'http_api_curl', array( &$parameters[0], $this->request, $this->url ) );
break;
diff --git a/src/wp-includes/class-wp-http.php b/src/wp-includes/class-wp-http.php
index 66cf907d0e00a..681b501a37aff 100644
--- a/src/wp-includes/class-wp-http.php
+++ b/src/wp-includes/class-wp-http.php
@@ -29,6 +29,64 @@
* Debugging includes several actions, which pass different variables for debugging the HTTP API.
*
* @since 2.7.0
+ *
+ * @phpstan-type HTTP_Response array{
+ * headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }
+ * @phpstan-type HTTP_Request_Args array{
+ * method?: string,
+ * timeout?: float|int,
+ * redirection?: int,
+ * httpversion?: string,
+ * 'user-agent'?: string,
+ * reject_unsafe_urls?: bool,
+ * blocking?: bool,
+ * headers?: string|mixed[]|null,
+ * cookies?: mixed[],
+ * body?: string|mixed[]|null,
+ * compress?: bool,
+ * decompress?: bool,
+ * sslverify?: bool,
+ * sslcertificates?: string,
+ * stream?: bool,
+ * filename?: string|null,
+ * limit_response_size?: int|null,
+ * ...
+ * }
+ * @phpstan-type Parsed_HTTP_Request_Args array{
+ * method: string,
+ * timeout: float|int,
+ * redirection: int,
+ * httpversion: string,
+ * 'user-agent': string,
+ * reject_unsafe_urls: bool,
+ * blocking: bool,
+ * headers: string|mixed[]|null,
+ * cookies: mixed[],
+ * body: string|mixed[]|null,
+ * compress: bool,
+ * decompress: bool,
+ * sslverify: bool,
+ * sslcertificates: string,
+ * stream: bool,
+ * filename: string|null,
+ * limit_response_size: int|null,
+ * _redirection: int,
+ * ...
+ * }
+ * @phpstan-type Prepared_Request array{
+ * url: string,
+ * headers: mixed[],
+ * data: mixed,
+ * type: mixed,
+ * options: array,
+ * args: Parsed_HTTP_Request_Args,
+ * }
*/
#[AllowDynamicProperties]
class WP_Http {
@@ -166,8 +224,235 @@ class WP_Http {
* @type string|null $filename Optional. Filename of the response.
* @type WP_HTTP_Requests_Response|null $http_response Response object.
* }
+ *
+ * @phpstan-param string|HTTP_Request_Args $args
+ * @phpstan-return HTTP_Response|WP_Error
*/
public function request( $url, $args = array() ) {
+ if ( ! is_array( $args ) ) {
+ $args = wp_parse_args( $args );
+ }
+
+ $prepared = $this->prepare_request( $url, $args );
+
+ if ( is_wp_error( $prepared ) ) {
+ return $prepared;
+ }
+
+ // The request was short-circuited by the 'pre_http_request' filter.
+ if ( array_key_exists( 'response', $prepared ) ) {
+ return $prepared['response'];
+ }
+
+ // Avoid issues where mbstring.func_overload is enabled.
+ mbstring_binary_safe_encoding();
+
+ try {
+ $response = WpOrg\Requests\Requests::request(
+ $prepared['url'],
+ $prepared['headers'],
+ $prepared['data'],
+ $prepared['type'],
+ $prepared['options']
+ );
+ } catch ( WpOrg\Requests\Exception $e ) {
+ $response = new WP_Error( 'http_request_failed', $e->getMessage() );
+ } finally {
+ reset_mbstring_encoding();
+ }
+
+ return $this->finalize_response( $response, $prepared['args'], $prepared['url'] );
+ }
+
+ /**
+ * Sends multiple HTTP requests concurrently and returns their responses.
+ *
+ * Every request is prepared, and its response processed, exactly like a request
+ * sent through WP_Http::request(): the 'http_request_args', 'pre_http_request' and
+ * 'http_response' filters and the 'http_api_debug' action apply to each request
+ * individually. The requests that were not short-circuited are then sent side by
+ * side, at most $concurrency at a time.
+ *
+ * Non-blocking requests are not supported: every request is performed in full.
+ *
+ * @since 7.3.0
+ *
+ * @see WP_Http::request() For the accepted request arguments and the response format.
+ *
+ * @param array $requests Requests to send, keyed by an identifier of the caller's choosing.
+ * Each request is either a URL string, for a GET request with the
+ * default arguments, or an array with the request URL under 'url'
+ * and, optionally, the request arguments under 'args'.
+ * See {@see WP_Http::request()} for the accepted request arguments.
+ * @param array $options {
+ * Optional. Options that apply to the batch of requests.
+ *
+ * @type int $concurrency Maximum number of requests to send at once. Default 6. Minimum 1.
+ * }
+ * @return array Responses keyed like $requests. Each is a response array, or a WP_Error
+ * on failure. See {@see WP_Http::request()} for the response format.
+ * @phpstan-param array $requests
+ * @phpstan-return array
+ */
+ public function request_multiple( array $requests, array $options = array() ): array {
+ $responses = array();
+ $pending = array();
+
+ foreach ( $requests as $id => $request ) {
+ if ( ! is_array( $request ) ) {
+ $request = array( 'url' => $request );
+ }
+
+ $url = $request['url'] ?? '';
+ $args = $request['args'] ?? array();
+
+ if ( ! is_array( $args ) ) {
+ $args = wp_parse_args( $args );
+ }
+
+ // Batches cannot send non-blocking requests, each request is performed in full.
+ $args['blocking'] = true;
+
+ $prepared = $this->prepare_request( $url, $args );
+
+ if ( is_wp_error( $prepared ) ) {
+ $responses[ $id ] = $prepared;
+ } elseif ( array_key_exists( 'response', $prepared ) ) {
+ // The request was short-circuited by the 'pre_http_request' filter.
+ $responses[ $id ] = $prepared['response'];
+ } else {
+ $pending[ $id ] = $prepared;
+ }
+ }
+
+ if ( ! empty( $pending ) ) {
+ $concurrency = max( 1, (int) ( $options['concurrency'] ?? 6 ) );
+
+ /**
+ * Filters the maximum number of HTTP requests that WP_Http::request_multiple() sends at once.
+ *
+ * @since 7.3.0
+ *
+ * @param int $concurrency Maximum number of requests to send at once. Default 6. Minimum 1.
+ * @param array $requests The requests to send. See WP_Http::request_multiple().
+ * @phpstan-param positive-int $concurrency
+ * @phpstan-param array $requests
+ */
+ $concurrency = (int) apply_filters( 'http_request_multiple_concurrency', $concurrency, $requests );
+ $concurrency = max( 1, $concurrency );
+
+ foreach ( array_chunk( $pending, $concurrency, true ) as $batch ) {
+ $results = array();
+ $batch_requests = array();
+
+ // Avoid issues where mbstring.func_overload is enabled.
+ mbstring_binary_safe_encoding();
+
+ try {
+ foreach ( $batch as $id => $prepared ) {
+ $request_url = $prepared['url'];
+ $request_headers = $prepared['headers'];
+ $request_data = $prepared['data'];
+ $request_type = $prepared['type'];
+ $request_options = $prepared['options'];
+
+ /*
+ * Requests::request() fires this hook for a single request, but
+ * Requests::request_multiple() does not, so fire it here to treat
+ * the requests of a batch like requests sent on their own.
+ */
+ $request_options['hooks']->dispatch(
+ 'requests.before_request',
+ array( &$request_url, &$request_headers, &$request_data, &$request_type, &$request_options )
+ );
+
+ /*
+ * Requests::request_multiple() throws for the whole batch if one of its URLs
+ * is not an HTTP(S) URL. Reject such a request on its own instead, with the
+ * same error that Requests::request() would throw for it.
+ */
+ if ( ! preg_match( '/^http(s)?:\/\//i', $request_url ) ) {
+ $results[ $id ] = new WpOrg\Requests\Exception( 'Only HTTP(S) requests are handled.', 'nonhttp', $request_url );
+ continue;
+ }
+
+ $batch_requests[ $id ] = array(
+ 'url' => $request_url,
+ 'headers' => $request_headers,
+ 'data' => $request_data,
+ 'type' => $request_type,
+ 'options' => $request_options,
+ );
+ }
+
+ if ( ! empty( $batch_requests ) ) {
+ /** @var array<\WpOrg\Requests\Response|\WpOrg\Requests\Exception> $batch_results */
+ $batch_results = WpOrg\Requests\Requests::request_multiple( $batch_requests );
+ $results = $batch_results + $results;
+ }
+ } catch ( WpOrg\Requests\Exception $e ) {
+ /*
+ * The batch failed as a whole. Its requests may already have been sent,
+ * so do not send them again: report the error for each of them instead.
+ */
+ foreach ( $batch as $id => $prepared ) {
+ if ( ! isset( $results[ $id ] ) ) {
+ $results[ $id ] = $e;
+ }
+ }
+ } finally {
+ reset_mbstring_encoding();
+ }
+
+ foreach ( $batch as $id => $prepared ) {
+ if ( isset( $results[ $id ] ) ) {
+ $result = $results[ $id ];
+ } else {
+ $result = new WP_Error( 'http_request_failed', __( 'No response was received.' ) );
+ }
+
+ $responses[ $id ] = $this->finalize_response( $result, $prepared['args'], $prepared['url'] );
+ }
+ }
+ }
+
+ // Return the responses in the order the requests were given.
+ $ordered = array();
+
+ foreach ( $requests as $id => $request ) {
+ $ordered[ $id ] = $responses[ $id ];
+ }
+
+ return $ordered;
+ }
+
+ /**
+ * Prepares a request for the Requests library.
+ *
+ * Parses and filters the request arguments, lets the 'pre_http_request' filter
+ * short-circuit the request, validates the URL, checks whether the request is
+ * blocked, and translates the arguments into options for the Requests library.
+ *
+ * @since 7.3.0
+ *
+ * @param string $url The request URL.
+ * @param array $args Optional. Request arguments. See {@see WP_Http::request()}.
+ * @return array|WP_Error {
+ * The prepared request, or a WP_Error if the request cannot be sent. If the request was
+ * short-circuited by the 'pre_http_request' filter, only the 'response' key is present.
+ *
+ * @type string $url The validated request URL.
+ * @type array $headers Request headers.
+ * @type mixed $data Request body.
+ * @type string $type Request method.
+ * @type array $options Options for the Requests library.
+ * @type array $args The parsed request arguments, after the 'http_request_args' filter.
+ * @type array|WP_Error $response Optional. The response returned by the 'pre_http_request' filter.
+ * }
+ * @phpstan-param HTTP_Request_Args $args
+ * @phpstan-return Prepared_Request|array{ response: HTTP_Response|WP_Error }|WP_Error
+ */
+ protected function prepare_request( $url, array $args = array() ) {
$defaults = array(
'method' => 'GET',
/**
@@ -233,9 +518,6 @@ public function request( $url, $args = array() ) {
'limit_response_size' => null,
);
- // Pre-parse for the HEAD checks.
- $args = wp_parse_args( $args );
-
// By default, HEAD requests do not cause redirections.
if ( isset( $args['method'] ) && 'HEAD' === $args['method'] ) {
$defaults['redirection'] = 0;
@@ -274,11 +556,14 @@ public function request( $url, $args = array() ) {
* @param false|array|WP_Error $response A preemptive return value of an HTTP request. Default false.
* @param array $parsed_args HTTP request arguments.
* @param string $url The request URL.
+ * @phpstan-param false|HTTP_Response|WP_Error $response
*/
$pre = apply_filters( 'pre_http_request', false, $parsed_args, $url );
if ( false !== $pre ) {
- return $pre;
+ return array(
+ 'response' => $pre,
+ );
}
if ( function_exists( 'wp_kses_bad_protocol' ) ) {
@@ -410,24 +695,46 @@ public function request( $url, $args = array() ) {
}
}
- // Avoid issues where mbstring.func_overload is enabled.
- mbstring_binary_safe_encoding();
+ return array(
+ 'url' => $url,
+ 'headers' => $headers,
+ 'data' => $data,
+ 'type' => $type,
+ 'options' => $options,
+ 'args' => $parsed_args,
+ );
+ }
- try {
- $requests_response = WpOrg\Requests\Requests::request( $url, $headers, $data, $type, $options );
+ /**
+ * Turns the result of a request into a WP_Http response array.
+ *
+ * Fires the 'http_api_debug' action and applies the 'http_response' filter.
+ *
+ * @since 7.3.0
+ *
+ * @param \WpOrg\Requests\Response|\WpOrg\Requests\Exception|WP_Error $response The response, or the error the
+ * request failed with.
+ * @param mixed[] $parsed_args The parsed request arguments, as
+ * returned by {@see WP_Http::prepare_request()}.
+ * @param string $url The request URL.
+ * @return array|WP_Error The response array, or a WP_Error on failure. See {@see WP_Http::request()}.
+ * @phpstan-param Parsed_HTTP_Request_Args $parsed_args
+ * @phpstan-return HTTP_Response|WP_Error
+ */
+ protected function finalize_response( $response, array $parsed_args, string $url ) {
+ if ( $response instanceof WpOrg\Requests\Exception ) {
+ $response = new WP_Error( 'http_request_failed', $response->getMessage() );
+ }
+ if ( ! is_wp_error( $response ) ) {
// Convert the response into an array.
- $http_response = new WP_HTTP_Requests_Response( $requests_response, $parsed_args['filename'] );
+ $http_response = new WP_HTTP_Requests_Response( $response, $parsed_args['filename'] );
$response = $http_response->to_array();
// Add the original object to the array.
$response['http_response'] = $http_response;
- } catch ( WpOrg\Requests\Exception $e ) {
- $response = new WP_Error( 'http_request_failed', $e->getMessage() );
}
- reset_mbstring_encoding();
-
/**
* Fires after an HTTP API response is received and before the response is returned.
*
@@ -647,6 +954,8 @@ private function _dispatch_request( $url, $args ) {
* @param string|array $args Optional. Override the defaults.
* @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
* A WP_Error instance upon error. See WP_Http::response() for details.
+ *
+ * @phpstan-return HTTP_Response|WP_Error
*/
public function post( $url, $args = array() ) {
$defaults = array( 'method' => 'POST' );
@@ -665,6 +974,8 @@ public function post( $url, $args = array() ) {
* @param string|array $args Optional. Override the defaults.
* @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
* A WP_Error instance upon error. See WP_Http::response() for details.
+ *
+ * @phpstan-return HTTP_Response|WP_Error
*/
public function get( $url, $args = array() ) {
$defaults = array( 'method' => 'GET' );
@@ -683,6 +994,8 @@ public function get( $url, $args = array() ) {
* @param string|array $args Optional. Override the defaults.
* @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
* A WP_Error instance upon error. See WP_Http::response() for details.
+ *
+ * @phpstan-return HTTP_Response|WP_Error
*/
public function head( $url, $args = array() ) {
$defaults = array( 'method' => 'HEAD' );
diff --git a/src/wp-includes/class-wp-locale.php b/src/wp-includes/class-wp-locale.php
index cd022fdaf9c83..7de22f0d24ee7 100644
--- a/src/wp-includes/class-wp-locale.php
+++ b/src/wp-includes/class-wp-locale.php
@@ -119,6 +119,8 @@ class WP_Locale {
*
* @since 6.2.0
* @var string|null
+ *
+ * @phpstan-var 'characters_excluding_spaces'|'characters_including_spaces'|'words'|null
*/
public $word_count_type;
diff --git a/src/wp-includes/class-wp-meta-query.php b/src/wp-includes/class-wp-meta-query.php
index 67e2d3d27ee0b..07bf07702027b 100644
--- a/src/wp-includes/class-wp-meta-query.php
+++ b/src/wp-includes/class-wp-meta-query.php
@@ -36,6 +36,7 @@ class WP_Meta_Query {
*
* @since 3.2.0
* @var string
+ * @phpstan-var 'AND'|'OR'|null
*/
public $relation;
@@ -170,8 +171,8 @@ public function __construct( $meta_query = array() ) {
return;
}
- if ( isset( $meta_query['relation'] ) && 'OR' === strtoupper( $meta_query['relation'] ) ) {
- $this->relation = 'OR';
+ if ( isset( $meta_query['relation'] ) ) {
+ $this->relation = $this->sanitize_relation( $meta_query['relation'] );
} else {
$this->relation = 'AND';
}
@@ -209,6 +210,19 @@ public function sanitize_query( $queries ) {
unset( $query['value'] );
}
+ /*
+ * Dropping an empty value can leave a clause that is no longer
+ * first-order, so sanitize it as a nested query instead. Otherwise
+ * it would be stored unsanitized and later treated as a nested
+ * query when the SQL is generated.
+ */
+ if ( ! $this->is_first_order_clause( $query ) ) {
+ $query = $this->sanitize_query( $query );
+ } elseif ( array_key_exists( 'relation', $query ) ) {
+ // A first-order clause has no relation of its own, but never store an unvalidated one.
+ $query['relation'] = $this->sanitize_relation( $query['relation'] );
+ }
+
$clean_queries[ $key ] = $query;
// Otherwise, it's a nested query, so we recurse.
@@ -226,7 +240,7 @@ public function sanitize_query( $queries ) {
}
// Sanitize the 'relation' key provided in the query.
- if ( isset( $relation ) && 'OR' === strtoupper( $relation ) ) {
+ if ( isset( $relation ) && 'OR' === $this->sanitize_relation( $relation ) ) {
$clean_queries['relation'] = 'OR';
$this->has_or_relation = true;
@@ -246,6 +260,23 @@ public function sanitize_query( $queries ) {
return $clean_queries;
}
+ /**
+ * Sanitizes a 'relation' operator.
+ *
+ * @since 7.1.5
+ *
+ * @param mixed $relation Raw relation key from the query argument. Typically the string 'AND' or 'OR'.
+ * @return string Sanitized relation. Either 'AND' or 'OR'.
+ * @phpstan-return 'AND'|'OR'
+ */
+ public function sanitize_relation( $relation ) {
+ if ( is_string( $relation ) && 'OR' === strtoupper( $relation ) ) {
+ return 'OR';
+ } else {
+ return 'AND';
+ }
+ }
+
/**
* Determines whether a query clause is first-order.
*
@@ -461,7 +492,8 @@ protected function get_sql_for_query( &$query, $depth = 0 ) {
foreach ( $query as $key => &$clause ) {
if ( 'relation' === $key ) {
- $relation = $query['relation'];
+ // Clauses that bypassed sanitize_query() may carry an unvalidated relation.
+ $relation = $this->sanitize_relation( $query['relation'] );
} elseif ( is_array( $clause ) ) {
// This is a first-order clause.
diff --git a/src/wp-includes/class-wp-object-cache.php b/src/wp-includes/class-wp-object-cache.php
index 443af49e3112d..0ac9e10dcde3c 100644
--- a/src/wp-includes/class-wp-object-cache.php
+++ b/src/wp-includes/class-wp-object-cache.php
@@ -154,10 +154,15 @@ protected function is_valid_key( $key ) {
wp_load_translations_early();
}
- $message = is_string( $key )
- ? __( 'Cache key must not be an empty string.' )
- /* translators: %s: The type of the given cache key. */
- : sprintf( __( 'Cache key must be an integer or a non-empty string, %s given.' ), $type );
+ if ( is_string( $key ) ) {
+ $message = __( 'Cache key must not be an empty string.' );
+ } else {
+ $message = sprintf(
+ /* translators: %s: The type of the given cache key. */
+ __( 'Cache key must be an integer or a non-empty string, %s given.' ),
+ $type
+ );
+ }
_doing_it_wrong(
sprintf( '%s::%s', __CLASS__, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 )[1]['function'] ),
diff --git a/src/wp-includes/class-wp-oembed-controller.php b/src/wp-includes/class-wp-oembed-controller.php
index d78a76d885a24..65e131f390749 100644
--- a/src/wp-includes/class-wp-oembed-controller.php
+++ b/src/wp-includes/class-wp-oembed-controller.php
@@ -176,6 +176,10 @@ public function get_proxy_item( $request ) {
$cache_key = 'oembed_' . md5( serialize( $args ) );
$data = get_transient( $cache_key );
if ( ! empty( $data ) ) {
+ // Only embed handlers return scripts, and their responses are not cached.
+ if ( is_object( $data ) ) {
+ unset( $data->scripts );
+ }
return $data;
}
@@ -222,6 +226,11 @@ public function get_proxy_item( $request ) {
return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) );
}
+ // Only embed handlers return scripts.
+ if ( is_object( $data ) ) {
+ unset( $data->scripts );
+ }
+
/** This filter is documented in wp-includes/class-wp-oembed.php */
$data->html = apply_filters( 'oembed_result', _wp_oembed_get_object()->data2html( (object) $data, $url ), $url, $args );
diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php
index 44220d06c9b3c..c5e048efe3806 100644
--- a/src/wp-includes/class-wp-query.php
+++ b/src/wp-includes/class-wp-query.php
@@ -2097,25 +2097,26 @@ public function get_posts() {
}
if ( '' !== $query_vars['menu_order'] ) {
- $where .= " AND {$wpdb->posts}.menu_order = " . $query_vars['menu_order'];
+ // The value is wrapped in an array so that an array value is queried as 0 instead of dropping the condition.
+ $where .= $wpdb->prepare( " AND {$wpdb->posts}.menu_order = %d", array( $query_vars['menu_order'] ) );
}
// The "m" parameter is meant for months but accepts datetimes of varying specificity.
if ( $query_vars['m'] ) {
- $where .= " AND YEAR({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 0, 4 );
+ $where .= $wpdb->prepare( " AND YEAR({$wpdb->posts}.post_date)=%d", substr( $query_vars['m'], 0, 4 ) );
if ( strlen( $query_vars['m'] ) > 5 ) {
- $where .= " AND MONTH({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 4, 2 );
+ $where .= $wpdb->prepare( " AND MONTH({$wpdb->posts}.post_date)=%02d", substr( $query_vars['m'], 4, 2 ) );
}
if ( strlen( $query_vars['m'] ) > 7 ) {
- $where .= " AND DAYOFMONTH({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 6, 2 );
+ $where .= $wpdb->prepare( " AND DAYOFMONTH({$wpdb->posts}.post_date)=%02d", substr( $query_vars['m'], 6, 2 ) );
}
if ( strlen( $query_vars['m'] ) > 9 ) {
- $where .= " AND HOUR({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 8, 2 );
+ $where .= $wpdb->prepare( " AND HOUR({$wpdb->posts}.post_date)=%02d", substr( $query_vars['m'], 8, 2 ) );
}
if ( strlen( $query_vars['m'] ) > 11 ) {
- $where .= " AND MINUTE({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 10, 2 );
+ $where .= $wpdb->prepare( " AND MINUTE({$wpdb->posts}.post_date)=%02d", substr( $query_vars['m'], 10, 2 ) );
}
if ( strlen( $query_vars['m'] ) > 13 ) {
- $where .= " AND SECOND({$wpdb->posts}.post_date)=" . substr( $query_vars['m'], 12, 2 );
+ $where .= $wpdb->prepare( " AND SECOND({$wpdb->posts}.post_date)=%02d", substr( $query_vars['m'], 12, 2 ) );
}
}
@@ -2224,8 +2225,9 @@ public function get_posts() {
if ( ( 'page' !== get_option( 'show_on_front' ) ) || empty( $page_for_posts ) || ( $reqpage != $page_for_posts ) ) {
$query_vars['pagename'] = sanitize_title_for_query( wp_basename( $query_vars['pagename'] ) );
$query_vars['name'] = $query_vars['pagename'];
- $where .= " AND ({$wpdb->posts}.ID = '$reqpage')";
- $reqpage_obj = get_post( $reqpage );
+ // The value is wrapped in an array so that an array value is queried as 0 instead of dropping the condition.
+ $where .= $wpdb->prepare( " AND ({$wpdb->posts}.ID = '%d')", array( $reqpage ) ); // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.QuotedSimplePlaceholder -- Quoted to keep the SQL unchanged for filters.
+ $reqpage_obj = get_post( $reqpage );
if ( is_object( $reqpage_obj ) && 'attachment' === $reqpage_obj->post_type ) {
$this->is_attachment = true;
$post_type = 'attachment';
@@ -2254,7 +2256,8 @@ public function get_posts() {
// If a post number is specified, load that post.
if ( $query_vars['p'] ) {
- $where .= " AND {$wpdb->posts}.ID = " . $query_vars['p'];
+ // The value is wrapped in an array so that an array value is queried as 0 instead of dropping the condition.
+ $where .= $wpdb->prepare( " AND {$wpdb->posts}.ID = %d", array( $query_vars['p'] ) );
} elseif ( $query_vars['post__in'] ) {
// Duplicate array before sorting to allow for the orderby clause.
$post__in_for_where = $query_vars['post__in'];
@@ -2286,7 +2289,8 @@ public function get_posts() {
if ( $query_vars['page_id'] ) {
if ( ( 'page' !== get_option( 'show_on_front' ) ) || ( get_option( 'page_for_posts' ) != $query_vars['page_id'] ) ) {
$query_vars['p'] = $query_vars['page_id'];
- $where = " AND {$wpdb->posts}.ID = " . $query_vars['page_id'];
+ // The value is wrapped in an array so that an array value is queried as 0 instead of dropping the condition.
+ $where = $wpdb->prepare( " AND {$wpdb->posts}.ID = %d", array( $query_vars['page_id'] ) );
}
}
@@ -2677,16 +2681,16 @@ public function get_posts() {
if ( in_array( 'any', $q_status, true ) ) {
foreach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) {
if ( ! in_array( $status, $q_status, true ) ) {
- $e_status[] = "{$wpdb->posts}.post_status <> '$status'";
+ $e_status[] = $wpdb->prepare( "{$wpdb->posts}.post_status <> %s", $status );
}
}
} else {
foreach ( get_post_stati() as $status ) {
if ( in_array( $status, $q_status, true ) ) {
if ( 'private' === $status ) {
- $p_status[] = "{$wpdb->posts}.post_status = '$status'";
+ $p_status[] = $wpdb->prepare( "{$wpdb->posts}.post_status = %s", $status );
} else {
- $r_status[] = "{$wpdb->posts}.post_status = '$status'";
+ $r_status[] = $wpdb->prepare( "{$wpdb->posts}.post_status = %s", $status );
}
}
}
@@ -2702,14 +2706,14 @@ public function get_posts() {
}
if ( ! empty( $r_status ) ) {
if ( ! empty( $query_vars['perm'] ) && 'editable' === $query_vars['perm'] && ! current_user_can( $edit_others_cap ) ) {
- $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $r_status ) . '))';
+ $statuswheres[] = $wpdb->prepare( "({$wpdb->posts}.post_author = %d ", $user_id ) . 'AND (' . implode( ' OR ', $r_status ) . '))';
} else {
$statuswheres[] = '(' . implode( ' OR ', $r_status ) . ')';
}
}
if ( ! empty( $p_status ) ) {
if ( ! empty( $query_vars['perm'] ) && 'readable' === $query_vars['perm'] && ! current_user_can( $read_private_cap ) ) {
- $statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $p_status ) . '))';
+ $statuswheres[] = $wpdb->prepare( "({$wpdb->posts}.post_author = %d ", $user_id ) . 'AND (' . implode( ' OR ', $p_status ) . '))';
} else {
$statuswheres[] = '(' . implode( ' OR ', $p_status ) . ')';
}
@@ -2749,7 +2753,7 @@ public function get_posts() {
$public_statuses = get_post_stati( array( 'public' => true ) );
$status_clauses = array();
foreach ( $public_statuses as $public_status ) {
- $status_clauses[] = "{$wpdb->posts}.post_status = '$public_status'";
+ $status_clauses[] = $wpdb->prepare( "{$wpdb->posts}.post_status = %s", $public_status );
}
$type_where .= implode( ' OR ', $status_clauses );
@@ -2762,7 +2766,7 @@ public function get_posts() {
)
);
foreach ( $admin_all_statuses as $admin_all_status ) {
- $type_where .= " OR {$wpdb->posts}.post_status = '$admin_all_status'";
+ $type_where .= $wpdb->prepare( " OR {$wpdb->posts}.post_status = %s", $admin_all_status );
}
}
@@ -2771,7 +2775,7 @@ public function get_posts() {
$read_private_cap = $queried_post_type_object->cap->read_private_posts;
$private_statuses = get_post_stati( array( 'private' => true ) );
foreach ( $private_statuses as $private_status ) {
- $type_where .= current_user_can( $read_private_cap ) ? " \nOR {$wpdb->posts}.post_status = '$private_status'" : " \nOR ({$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$private_status')";
+ $type_where .= current_user_can( $read_private_cap ) ? $wpdb->prepare( " \nOR {$wpdb->posts}.post_status = %s", $private_status ) : $wpdb->prepare( " \nOR ({$wpdb->posts}.post_author = %d AND {$wpdb->posts}.post_status = %s)", $user_id, $private_status );
}
}
@@ -2886,6 +2890,9 @@ public function get_posts() {
*/
$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
+ // The value is wrapped in an array so that an array value is queried as 0 instead of dropping the condition.
+ $climits = $wpdb->prepare( 'LIMIT %d', array( get_option( 'posts_per_rss' ) ) );
+
/**
* Filters the LIMIT clause of the comments feed query before sending.
*
@@ -2894,7 +2901,7 @@ public function get_posts() {
* @param string $climits The JOIN clause of the query.
* @param WP_Query $query The WP_Query instance (passed by reference).
*/
- $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) );
+ $climits = apply_filters_ref_array( 'comment_feed_limits', array( $climits, &$this ) );
}
$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
@@ -3558,7 +3565,7 @@ public function get_posts() {
$cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
/** This filter is documented in wp-includes/class-wp-query.php */
- $cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1' AND {$wpdb->comments}.comment_type NOT IN ( 'note', 'reaction' )", &$this ) );
+ $cwhere = apply_filters_ref_array( 'comment_feed_where', array( $wpdb->prepare( "WHERE comment_post_ID = '%d' AND comment_approved = '1' AND {$wpdb->comments}.comment_type NOT IN ( 'note', 'reaction' )", $this->posts[0]->ID ), &$this ) ); // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.QuotedSimplePlaceholder -- Quoted to keep the SQL unchanged for filters.
/** This filter is documented in wp-includes/class-wp-query.php */
$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
@@ -3568,8 +3575,11 @@ public function get_posts() {
$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
+ // The value is wrapped in an array so that an array value is queried as 0 instead of dropping the condition.
+ $climits = $wpdb->prepare( 'LIMIT %d', array( get_option( 'posts_per_rss' ) ) );
+
/** This filter is documented in wp-includes/class-wp-query.php */
- $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) );
+ $climits = apply_filters_ref_array( 'comment_feed_limits', array( $climits, &$this ) );
$comments_request = "SELECT {$wpdb->comments}.comment_ID FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits";
diff --git a/src/wp-includes/class-wp-taxonomy.php b/src/wp-includes/class-wp-taxonomy.php
index f44ce34a11def..d563a2c4386da 100644
--- a/src/wp-includes/class-wp-taxonomy.php
+++ b/src/wp-includes/class-wp-taxonomy.php
@@ -633,8 +633,12 @@ public static function get_default_labels() {
'filter_by_item' => array( null, __( 'Filter by category' ) ),
'items_list_navigation' => array( __( 'Tags list navigation' ), __( 'Categories list navigation' ) ),
'items_list' => array( __( 'Tags list' ), __( 'Categories list' ) ),
- /* translators: Tab heading when selecting from the most used terms. */
- 'most_used' => array( _x( 'Most Used', 'tags' ), _x( 'Most Used', 'categories' ) ),
+ 'most_used' => array(
+ /* translators: Tab heading when selecting from the most used terms. */
+ _x( 'Most Used', 'tags' ),
+ /* translators: Tab heading when selecting from the most used terms. */
+ _x( 'Most Used', 'categories' ),
+ ),
'back_to_items' => array( __( '← Go to Tags' ), __( '← Go to Categories' ) ),
'item_link' => array(
_x( 'Tag Link', 'navigation link block title' ),
diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php
index 15d08fba457a9..85dc55bce5501 100644
--- a/src/wp-includes/class-wp-theme-json.php
+++ b/src/wp-includes/class-wp-theme-json.php
@@ -2283,7 +2283,7 @@ public function get_custom_css() {
$custom_block_css = $this->theme_json['styles']['blocks'][ $name ]['css'] ?? null;
if ( $custom_block_css ) {
$selector = static::$blocks_metadata[ $name ]['selector'];
- $stylesheet .= $this->process_blocks_custom_css( $custom_block_css, $selector );
+ $stylesheet .= static::process_blocks_custom_css( $custom_block_css, $selector );
}
}
}
@@ -4202,7 +4202,7 @@ public function get_styles_for_block( $block_metadata ) {
// Store custom CSS for the style variation.
if ( isset( $style_variation_node['css'] ) ) {
- $style_variation_custom_css[ $style_variation['selector'] ] = $this->process_blocks_custom_css( $style_variation_node['css'], $variation_css_selector );
+ $style_variation_custom_css[ $style_variation['selector'] ] = static::process_blocks_custom_css( $style_variation_node['css'], $variation_css_selector );
}
// Store variation metadata and node for layout styles generation.
@@ -4534,7 +4534,7 @@ static function ( $pseudo_selector ) use ( $selector ) {
// 7. Generate and append any custom CSS rules.
if ( isset( $node['css'] ) && ! $is_root_selector ) {
$css_selector = $css_feature_selector ?? $selector;
- $block_rules .= $this->process_blocks_custom_css( $node['css'], $css_selector );
+ $block_rules .= static::process_blocks_custom_css( $node['css'], $css_selector );
}
// 8. Wrap the entire block output in a media query if this is a responsive node.
@@ -5860,9 +5860,18 @@ private static function compute_spacing_sizes( $spacing_scale ) {
break;
}
+ if ( $below_midpoint_count === $steps_mid_point - 1 ) {
+ $name = __( 'Small' );
+ } else {
+ $name = sprintf(
+ /* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Small. */
+ __( '%sX-Small' ),
+ (string) $x_small_count
+ );
+ }
+
$below_sizes[] = array(
- /* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Small. */
- 'name' => $below_midpoint_count === $steps_mid_point - 1 ? __( 'Small' ) : sprintf( __( '%sX-Small' ), (string) $x_small_count ),
+ 'name' => $name,
'slug' => (string) $slug,
'size' => round( $current_step, 2 ) . $unit,
);
@@ -5897,9 +5906,18 @@ private static function compute_spacing_sizes( $spacing_scale ) {
? $current_step + $spacing_scale['increment']
: ( $spacing_scale['increment'] >= 1 ? $current_step * $spacing_scale['increment'] : $current_step / $spacing_scale['increment'] );
+ if ( 0 === $above_midpoint_count ) {
+ $name = __( 'Large' );
+ } else {
+ $name = sprintf(
+ /* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Large. */
+ __( '%sX-Large' ),
+ (string) $x_large_count
+ );
+ }
+
$above_sizes[] = array(
- /* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Large. */
- 'name' => 0 === $above_midpoint_count ? __( 'Large' ) : sprintf( __( '%sX-Large' ), (string) $x_large_count ),
+ 'name' => $name,
'slug' => (string) $slug,
'size' => round( $current_step, 2 ) . $unit,
);
diff --git a/src/wp-includes/class-wp-widget.php b/src/wp-includes/class-wp-widget.php
index f1d432c0d3fb5..9cc2d79a7ac20 100644
--- a/src/wp-includes/class-wp-widget.php
+++ b/src/wp-includes/class-wp-widget.php
@@ -109,6 +109,22 @@ class WP_Widget {
* @param array $args Display arguments including 'before_title', 'after_title',
* 'before_widget', and 'after_widget'.
* @param array $instance The settings for the particular instance of the widget.
+ *
+ * @phpstan-param array{
+ * name?: string,
+ * id?: string,
+ * description?: string,
+ * class?: string,
+ * before_widget: string,
+ * after_widget: string,
+ * before_title: string,
+ * after_title: string,
+ * before_sidebar?: string,
+ * after_sidebar?: string,
+ * show_in_rest?: bool,
+ * widget_id?: string,
+ * widget_name?: string,
+ * } $args
*/
public function widget( $args, $instance ) {
die( 'function WP_Widget::widget() must be overridden in a subclass.' );
diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php
index 4ac680065f036..56448aa6e2520 100644
--- a/src/wp-includes/class-wp-xmlrpc-server.php
+++ b/src/wp-includes/class-wp-xmlrpc-server.php
@@ -50,6 +50,17 @@ class wp_xmlrpc_server extends IXR_Server {
*/
protected $auth_failed = false;
+ /**
+ * Flags that a pingback has already been processed in this instance of wp_xmlrpc_server.
+ *
+ * Prevents a single `system.multicall` request from processing an unbounded number of pingbacks.
+ *
+ * @since 7.1.5
+ *
+ * @var bool
+ */
+ protected $pingback_processed = false;
+
/**
* Flags that XML-RPC is enabled
*
@@ -1243,6 +1254,9 @@ protected function _prepare_comment( $comment ) {
} else {
$comment_status = $comment->comment_approved;
}
+
+ $can_moderate_or_edit = current_user_can( 'moderate_comments' ) || current_user_can( 'edit_comment', $comment->comment_ID );
+
$_comment = array(
'date_created_gmt' => $comment_date_gmt,
'user_id' => $comment->user_id,
@@ -1255,8 +1269,8 @@ protected function _prepare_comment( $comment ) {
'post_title' => get_the_title( $comment->comment_post_ID ),
'author' => $comment->comment_author,
'author_url' => $comment->comment_author_url,
- 'author_email' => $comment->comment_author_email,
- 'author_ip' => $comment->comment_author_IP,
+ 'author_email' => $can_moderate_or_edit ? $comment->comment_author_email : '',
+ 'author_ip' => $can_moderate_or_edit ? $comment->comment_author_IP : '',
'type' => $comment->comment_type,
);
@@ -3784,7 +3798,9 @@ public function wp_getComments( $args ) {
$status = $struct['status'] ?? '';
- if ( ! current_user_can( 'moderate_comments' ) && 'approve' !== $status ) {
+ $can_moderate = current_user_can( 'moderate_comments' );
+
+ if ( ! $can_moderate && 'approve' !== $status ) {
return new IXR_Error( 401, __( 'Invalid comment status.' ) );
}
@@ -3793,6 +3809,17 @@ public function wp_getComments( $args ) {
$post_id = absint( $struct['post_id'] );
}
+ $has_public_status = static function ( $post ) {
+ $status = get_post_status( $post );
+ $status_object = $status ? get_post_status_object( $status ) : null;
+
+ return $status_object && $status_object->public;
+ };
+
+ if ( $post_id && ! $can_moderate && ! $has_public_status( $post_id ) && ! current_user_can( 'read_post', $post_id ) ) {
+ return new IXR_Error( 401, __( 'Invalid post ID.' ) );
+ }
+
$post_type = '';
if ( isset( $struct['post_type'] ) ) {
$post_type_object = get_post_type_object( $struct['post_type'] );
@@ -3814,17 +3841,31 @@ public function wp_getComments( $args ) {
$comments = get_comments(
array(
- 'status' => $status,
- 'post_id' => $post_id,
- 'offset' => $offset,
- 'number' => $number,
- 'post_type' => $post_type,
+ 'status' => $status,
+ 'post_id' => $post_id,
+ 'offset' => $offset,
+ 'number' => $number,
+ 'post_type' => $post_type,
+ 'update_comment_post_cache' => true,
)
);
$comments_struct = array();
if ( is_array( $comments ) ) {
foreach ( $comments as $comment ) {
+ if ( ! $can_moderate && ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
+ $post = get_post( $comment->comment_post_ID );
+
+ if (
+ ! $post
+ || ! is_post_type_viewable( $post->post_type )
+ || post_password_required( $post )
+ || ( ! $has_public_status( $post ) && ! current_user_can( 'read_post', $post->ID ) )
+ ) {
+ continue;
+ }
+ }
+
$comments_struct[] = $this->_prepare_comment( $comment );
}
}
@@ -3930,7 +3971,9 @@ public function wp_editComment( $args ) {
return $this->error;
}
- if ( ! get_comment( $comment_id ) ) {
+ $existing_comment = get_comment( $comment_id );
+
+ if ( ! $existing_comment ) {
return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
}
@@ -3938,6 +3981,11 @@ public function wp_editComment( $args ) {
return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) );
}
+ // Reactions are only validated on creation. Removing one is a delete.
+ if ( 'reaction' === $existing_comment->comment_type ) {
+ return new IXR_Error( 403, __( 'Reactions cannot be edited. Remove the reaction and add a new one instead.' ) );
+ }
+
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'wp.editComment', $args, $this );
$comment = array(
@@ -7067,6 +7115,16 @@ public function mt_publishPost( $args ) {
public function pingback_ping( $args ) {
global $wpdb;
+ /*
+ * Checked before the `xmlrpc_call` action and any database or network work, so repeated
+ * calls in a multicall cost nothing, including in plugins that check each pingback.
+ */
+ if ( $this->pingback_processed ) {
+ return $this->pingback_error( 49, __( 'Only one pingback can be processed per request.' ) );
+ }
+
+ $this->pingback_processed = true;
+
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'pingback.ping', $args, $this );
diff --git a/src/wp-includes/class-wpdb.php b/src/wp-includes/class-wpdb.php
index 5f5c05bd1553e..39958db99fe19 100644
--- a/src/wp-includes/class-wpdb.php
+++ b/src/wp-includes/class-wpdb.php
@@ -125,6 +125,7 @@ class wpdb {
* @since 0.71
*
* @var int
+ * @phpstan-var non-negative-int
*/
public $insert_id = 0;
@@ -3121,6 +3122,8 @@ public function get_var( $query = null, $x = 0, $y = 0 ) {
* )
* : null
* )
+ *
+ * @phpstan-param non-negative-int $y
*/
public function get_row( $query = null, $output = OBJECT, $y = 0 ) {
$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index 6a1641cbae4d0..8a48108effa43 100644
--- a/src/wp-includes/comment.php
+++ b/src/wp-includes/comment.php
@@ -1993,6 +1993,8 @@ function wp_unspam_comment( $comment_id ) {
*
* @param int|WP_Comment $comment_id Comment ID or WP_Comment object
* @return string|false Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure.
+ *
+ * @phpstan-return 'approved'|'spam'|'trash'|'unapproved'|false
*/
function wp_get_comment_status( $comment_id ) {
$comment = get_comment( $comment_id );
diff --git a/src/wp-includes/compat-utf8.php b/src/wp-includes/compat-utf8.php
index 326786fe608f2..924ee4443c412 100644
--- a/src/wp-includes/compat-utf8.php
+++ b/src/wp-includes/compat-utf8.php
@@ -42,6 +42,7 @@
* @param int|null $max_bytes Stop scanning after this many bytes have been seen.
* @param int|null $max_code_points Stop scanning after this many code points have been seen.
* @param bool|null $has_noncharacters Set to indicate if scanned string contained noncharacters.
+ * @param-out bool $has_noncharacters
* @return int How many code points were successfully scanned.
*/
function _wp_scan_utf8( string $bytes, int &$at, int &$invalid_length, ?int $max_bytes = null, ?int $max_code_points = null, ?bool &$has_noncharacters = null ): int {
@@ -151,7 +152,7 @@ function _wp_scan_utf8( string $bytes, int &$at, int &$invalid_length, ?int $max
// Covers the range U+FDD0–U+FDEF, U+FFFE, U+FFFF.
if ( 0xEF === $b1 ) {
- $has_noncharacters |= (
+ $has_noncharacters = $has_noncharacters || (
( 0xB7 === $b2 && $b3 >= 0x90 && $b3 <= 0xAF ) ||
( 0xBF === $b2 && ( 0xBE === $b3 || 0xBF === $b3 ) )
);
@@ -176,7 +177,7 @@ function _wp_scan_utf8( string $bytes, int &$at, int &$invalid_length, ?int $max
$i += 3;
// Covers U+1FFFE, U+1FFFF, U+2FFFE, U+2FFFF, …, U+10FFFE, U+10FFFF.
- $has_noncharacters |= (
+ $has_noncharacters = $has_noncharacters || (
( 0x0F === ( $b2 & 0x0F ) ) &&
0xBF === $b3 &&
( 0xBE === $b4 || 0xBF === $b4 )
@@ -376,6 +377,7 @@ function _wp_utf8_codepoint_count( string $text, ?int $byte_offset = 0, ?int $ma
* @param ?int $found_code_points Optional. Will be set to number of found code points in
* span, as this might be smaller than the maximum count if
* the string is not long enough.
+ * @param-out int $found_code_points
* @return int Number of bytes spanned by the code points.
*/
function _wp_utf8_codepoint_span( string $text, int $byte_offset, int $max_code_points, ?int &$found_code_points = 0 ): int {
diff --git a/src/wp-includes/feed.php b/src/wp-includes/feed.php
index 952194c1bce84..016d6a86b32f3 100644
--- a/src/wp-includes/feed.php
+++ b/src/wp-includes/feed.php
@@ -599,6 +599,8 @@ function atom_enclosure() {
*
* @param string $data Input string.
* @return array array(type, value)
+ *
+ * @phpstan-return array{'html'|'text'|'xhtml', string}
*/
function prep_atom_text_construct( $data ) {
if ( ! str_contains( $data, '<' ) && ! str_contains( $data, '&' ) ) {
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
index ecae45083a6ca..6bfba5a873cb7 100644
--- a/src/wp-includes/formatting.php
+++ b/src/wp-includes/formatting.php
@@ -611,6 +611,8 @@ function wpautop( $text, $br = true ) {
*
* @param string $input The text which has to be formatted.
* @return string[] Array of the formatted text.
+ *
+ * @phpstan-return non-empty-list
*/
function wp_html_split( $input ) {
return preg_split( get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE );
@@ -2835,6 +2837,7 @@ function format_to_edit( $content, $rich_text = false ) {
* @param int $threshold Digit places number needs to be to not have zeros added.
* @return string Adds leading zeros to number if needed.
*
+ * @phpstan-param non-negative-int $threshold
* @phpstan-return (
* $threshold is 0
* ? lowercase-string&non-empty-string&numeric-string
@@ -3006,6 +3009,8 @@ function urldecode_deep( $value ) {
* @param string $email_address Email address.
* @param int $hex_encoding Optional. Set to 1 to enable hex encoding.
* @return string Converted email address.
+ *
+ * @phpstan-param 0|1 $hex_encoding
*/
function antispambot( $email_address, $hex_encoding = 0 ) {
$obfuscated = '';
@@ -4965,6 +4970,7 @@ function wp_make_link_relative( $link ) {
* of functions depending on the $option.
*
* @since 2.0.5
+ * @since 7.1.5 The `show_on_front` option is sanitized.
*
* @global wpdb $wpdb WordPress database abstraction object.
*
@@ -5205,6 +5211,13 @@ function sanitize_option( $option, $value ) {
}
break;
+ case 'show_on_front':
+ // Any value other than 'page' is treated as 'posts'.
+ if ( 'page' !== $value ) {
+ $value = 'posts';
+ }
+ break;
+
case 'default_role':
if ( ! get_role( $value ) && get_role( 'subscriber' ) ) {
$value = 'subscriber';
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index d9927baffbcd5..9f05a8c592a86 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -1041,6 +1041,8 @@ function wp_get_http_headers( $url, $deprecated = false ) {
* @global string $previousday The day of the previous post in the loop.
*
* @return int 1 when new day, 0 if not a new day.
+ *
+ * @phpstan-return 0|1
*/
function is_new_day() {
global $currentday, $previousday;
@@ -4525,6 +4527,7 @@ function _wp_die_process_input( $message, $title = '', $args = array() ) {
* greater than 0. Default 512.
* @return string|false The JSON encoded string, or false if it cannot be encoded.
*
+ * @phpstan-param positive-int $depth
* @phpstan-return non-empty-string|false
*/
function wp_json_encode( $value, $flags = 0, $depth = 512 ) {
@@ -6303,6 +6306,8 @@ function _doing_it_wrong( $function_name, $message, $version ) {
* before passing to this function to avoid being stripped {@see wp_kses()}.
* @param int $error_level Optional. The designated error type for this error.
* Only works with E_USER family of constants. Default E_USER_NOTICE.
+ *
+ * @phpstan-param E_USER_ERROR|E_USER_WARNING|E_USER_NOTICE|E_USER_DEPRECATED $error_level
*/
function wp_trigger_error( $function_name, $message, $error_level = E_USER_NOTICE ) {
/**
@@ -6739,6 +6744,8 @@ function is_main_network( $network_id = null ) {
* @since 4.3.0
*
* @return int The ID of the main network.
+ *
+ * @phpstan-return non-negative-int
*/
function get_main_network_id() {
if ( ! is_multisite() ) {
@@ -6768,6 +6775,8 @@ function get_main_network_id() {
* @since 4.3.0
*
* @param int $main_network_id The ID of the main network.
+ *
+ * @phpstan-param non-negative-int $main_network_id
*/
return (int) apply_filters( 'get_main_network_id', $main_network_id );
}
@@ -7250,6 +7259,8 @@ function __return_false() { // phpcs:ignore WordPress.NamingConventions.ValidFun
* @since 3.0.0
*
* @return int 0.
+ *
+ * @phpstan-return 0
*/
function __return_zero() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
return 0;
@@ -7263,6 +7274,8 @@ function __return_zero() { // phpcs:ignore WordPress.NamingConventions.ValidFunc
* @since 3.0.0
*
* @return array Empty array.
+ *
+ * @phpstan-return array{}
*/
function __return_empty_array() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
return array();
@@ -7291,6 +7304,8 @@ function __return_null() { // phpcs:ignore WordPress.NamingConventions.ValidFunc
* @see __return_null()
*
* @return string Empty string.
+ *
+ * @phpstan-return ''
*/
function __return_empty_string() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
return '';
@@ -8379,6 +8394,7 @@ function wp_unique_prefixed_id( $prefix = '' ) {
* @param string $prefix Optional. A prefix to prepend to the generated ID. Default empty string.
* @return string The generated unique ID for the array.
*
+ * @phpstan-param non-empty-array $data
* @phpstan-return ( $prefix is lowercase-string ? lowercase-string&non-falsy-string : non-falsy-string )
*/
function wp_unique_id_from_values( array $data, string $prefix = '' ): string {
@@ -9641,6 +9657,8 @@ function wp_application_password_created_notification( $user_id, $new_item ) {
return;
}
+ $switched_locale = switch_to_user_locale( $user->ID );
+
/* translators: Do not translate USERNAME, APPLICATION_PASSWORD_NAME, ADMIN_EMAIL, SITENAME, SITEURL, EMAIL: those are placeholders. */
$application_password_create_text = __(
'Hi ###USERNAME###,
@@ -9724,4 +9742,8 @@ function wp_application_password_created_notification( $user_id, $new_item ) {
$email['message'],
$email['headers']
);
+
+ if ( $switched_locale ) {
+ restore_previous_locale();
+ }
}
diff --git a/src/wp-includes/html-api/class-wp-html-tag-processor.php b/src/wp-includes/html-api/class-wp-html-tag-processor.php
index 7e047c4808081..34429f2b31aed 100644
--- a/src/wp-includes/html-api/class-wp-html-tag-processor.php
+++ b/src/wp-includes/html-api/class-wp-html-tag-processor.php
@@ -956,6 +956,8 @@ public function next_tag( $query = null ): bool {
* @since 7.1.0 Recognizes processing instructions.
*
* @return bool Whether a token was parsed.
+ *
+ * @phpstan-impure
*/
public function next_token(): bool {
return $this->base_class_next_token();
diff --git a/src/wp-includes/http.php b/src/wp-includes/http.php
index 34e1f452a797f..5796edb36176d 100644
--- a/src/wp-includes/http.php
+++ b/src/wp-includes/http.php
@@ -48,6 +48,15 @@ function _wp_http_get_object() {
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
* See WP_Http::request() for information on return value.
+ *
+ * @phpstan-return array{
+ * headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error
*/
function wp_safe_remote_request( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true;
@@ -77,6 +86,15 @@ function wp_safe_remote_request( $url, $args = array() ) {
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
* See WP_Http::request() for information on return value.
+ *
+ * @phpstan-return array{
+ * headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error
*/
function wp_safe_remote_get( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true;
@@ -106,6 +124,15 @@ function wp_safe_remote_get( $url, $args = array() ) {
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
* See WP_Http::request() for information on return value.
+ *
+ * @phpstan-return array{
+ * headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error
*/
function wp_safe_remote_post( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true;
@@ -135,6 +162,15 @@ function wp_safe_remote_post( $url, $args = array() ) {
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
* See WP_Http::request() for information on return value.
+ *
+ * @phpstan-return array{
+ * headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error
*/
function wp_safe_remote_head( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true;
@@ -142,6 +178,56 @@ function wp_safe_remote_head( $url, $args = array() ) {
return $http->head( $url, $args );
}
+/**
+ * Performs multiple HTTP requests concurrently using the safe variant of the HTTP API.
+ *
+ * Like wp_remote_request_multiple(), but every URL is validated to avoid redirection
+ * and request forgery attacks. See wp_safe_remote_request().
+ *
+ * @since 7.3.0
+ *
+ * @see wp_remote_request_multiple() For information on the request and response format.
+ *
+ * @param array $requests Requests to send. See {@see wp_remote_request_multiple()}.
+ * @param array $options {
+ * Optional. Options that apply to the batch of requests. See {@see WP_Http::request_multiple()}.
+ * Default empty array.
+ *
+ * @type int $concurrency Maximum number of requests to send at once. Default 6.
+ * }
+ * @return array Responses keyed like $requests. Each is a response array, or a WP_Error on failure.
+ * @phpstan-param array $requests
+ * @phpstan-return array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error>
+ */
+function wp_safe_remote_request_multiple( array $requests, array $options = array() ): array {
+ foreach ( $requests as $id => $request ) {
+ if ( ! is_array( $request ) ) {
+ $request = array( 'url' => $request );
+ }
+
+ $args = $request['args'] ?? array();
+
+ if ( ! is_array( $args ) ) {
+ $args = wp_parse_args( $args );
+ }
+
+ $args['reject_unsafe_urls'] = true;
+ $request['args'] = $args;
+
+ $requests[ $id ] = $request;
+ }
+
+ $http = _wp_http_get_object();
+ return $http->request_multiple( $requests, $options );
+}
+
/**
* Performs an HTTP request and returns its response.
*
@@ -162,6 +248,15 @@ function wp_safe_remote_head( $url, $args = array() ) {
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response array or a WP_Error on failure.
* See WP_Http::request() for information on return value.
+ *
+ * @phpstan-return array{
+ * headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error
*/
function wp_remote_request( $url, $args = array() ) {
$http = _wp_http_get_object();
@@ -183,6 +278,15 @@ function wp_remote_request( $url, $args = array() ) {
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
* See WP_Http::request() for information on return value.
+ *
+ * @phpstan-return array{
+ * headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error
*/
function wp_remote_get( $url, $args = array() ) {
$http = _wp_http_get_object();
@@ -204,6 +308,15 @@ function wp_remote_get( $url, $args = array() ) {
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
* See WP_Http::request() for information on return value.
+ *
+ * @phpstan-return array{
+ * headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error
*/
function wp_remote_post( $url, $args = array() ) {
$http = _wp_http_get_object();
@@ -225,12 +338,61 @@ function wp_remote_post( $url, $args = array() ) {
* See WP_Http::request() for information on accepted arguments.
* @return array|WP_Error The response or WP_Error on failure.
* See WP_Http::request() for information on return value.
+ *
+ * @phpstan-return array{
+ * headers: \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error
*/
function wp_remote_head( $url, $args = array() ) {
$http = _wp_http_get_object();
return $http->head( $url, $args );
}
+/**
+ * Performs multiple HTTP requests concurrently and returns their responses.
+ *
+ * The requests are sent side by side rather than one after the other, so a batch of
+ * requests takes about as long as its slowest request instead of the sum of all of them.
+ *
+ * Each request is filtered, and its response processed, individually and exactly as
+ * if it had been sent with wp_remote_request().
+ *
+ * @since 7.3.0
+ *
+ * @see WP_Http::request_multiple() For information on the request format and the batch options.
+ * @see WP_Http::request() For information on accepted request arguments and the response format.
+ *
+ * @param array $requests Requests to send, keyed by an identifier of the caller's choosing.
+ * Each request is either a URL string, for a GET request with the
+ * default arguments, or an array with a 'url' key and an optional
+ * 'args' key holding the request arguments.
+ * @param array $options {
+ * Optional. Options that apply to the batch of requests. See {@see WP_Http::request_multiple()}.
+ * Default empty array.
+ *
+ * @type int $concurrency Maximum number of requests to send at once. Default 6.
+ * }
+ * @return array Responses keyed like $requests. Each is a response array, or a WP_Error on failure.
+ * @phpstan-param array $requests
+ * @phpstan-return array,
+ * body: string,
+ * response: array{code: int|false, message: string|false},
+ * cookies: WP_Http_Cookie[],
+ * filename?: string|null,
+ * http_response?: WP_HTTP_Requests_Response|null,
+ * }|WP_Error>
+ */
+function wp_remote_request_multiple( array $requests, array $options = array() ): array {
+ $http = _wp_http_get_object();
+ return $http->request_multiple( $requests, $options );
+}
+
/**
* Retrieves only the headers from the raw response.
*
diff --git a/src/wp-includes/images/crystal/archive.png b/src/wp-includes/images/crystal/archive.png
index ca038c7dac562..853594a6c9ba3 100644
Binary files a/src/wp-includes/images/crystal/archive.png and b/src/wp-includes/images/crystal/archive.png differ
diff --git a/src/wp-includes/images/crystal/interactive.png b/src/wp-includes/images/crystal/interactive.png
index 184e76ab9cbbe..4d1778daab6b5 100644
Binary files a/src/wp-includes/images/crystal/interactive.png and b/src/wp-includes/images/crystal/interactive.png differ
diff --git a/src/wp-includes/images/crystal/spreadsheet.png b/src/wp-includes/images/crystal/spreadsheet.png
index bae1f6d11b143..da1c7230b866b 100644
Binary files a/src/wp-includes/images/crystal/spreadsheet.png and b/src/wp-includes/images/crystal/spreadsheet.png differ
diff --git a/src/wp-includes/images/icon-library/update.svg b/src/wp-includes/images/icon-library/update.svg
index abf7d3491b6ce..0658ad2f1ed6d 100644
--- a/src/wp-includes/images/icon-library/update.svg
+++ b/src/wp-includes/images/icon-library/update.svg
@@ -1,3 +1,4 @@
diff --git a/src/wp-includes/images/w-logo-blue.png b/src/wp-includes/images/w-logo-blue.png
index 11e550c74e07c..ad3e07cc4beb0 100644
Binary files a/src/wp-includes/images/w-logo-blue.png and b/src/wp-includes/images/w-logo-blue.png differ
diff --git a/src/wp-includes/interactivity-api/interactivity-api.php b/src/wp-includes/interactivity-api/interactivity-api.php
index 81c6362b94a39..b08e14191602a 100644
--- a/src/wp-includes/interactivity-api/interactivity-api.php
+++ b/src/wp-includes/interactivity-api/interactivity-api.php
@@ -103,7 +103,7 @@ function wp_interactivity_config( string $store_namespace, array $config = array
*/
function wp_interactivity_data_wp_context( array $context, string $store_namespace = '' ): string {
return 'data-wp-context=\'' .
- ( $store_namespace ? $store_namespace . '::' : '' ) .
+ ( $store_namespace ? esc_attr( $store_namespace ) . '::' : '' ) .
( empty( $context ) ? '{}' : wp_json_encode( $context, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ) ) .
'\'';
}
diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
index ce309d2ecd2ae..b9086e733c966 100644
--- a/src/wp-includes/load.php
+++ b/src/wp-includes/load.php
@@ -11,6 +11,8 @@
* @since 4.4.0
*
* @return string The HTTP protocol. Default: HTTP/1.0.
+ *
+ * @phpstan-return 'HTTP/1.0'|'HTTP/1.1'|'HTTP/2'|'HTTP/2.0'|'HTTP/3'
*/
function wp_get_server_protocol() {
$protocol = $_SERVER['SERVER_PROTOCOL'] ?? '';
@@ -1517,6 +1519,8 @@ function absint( $maybeint ): int {
* @global int $blog_id
*
* @return int Site ID.
+ *
+ * @phpstan-return non-negative-int
*/
function get_current_blog_id() {
global $blog_id;
@@ -1530,6 +1534,8 @@ function get_current_blog_id() {
* @since 4.6.0
*
* @return int The ID of the current network.
+ *
+ * @phpstan-return non-negative-int
*/
function get_current_network_id() {
if ( ! is_multisite() ) {
@@ -2007,7 +2013,7 @@ function wp_is_json_media_type( $media_type ) {
static $cache = array();
if ( ! isset( $cache[ $media_type ] ) ) {
- $cache[ $media_type ] = (bool) preg_match( '/(^|\s|,)application\/([\w!#\$&-\^\.\+]+\+)?json(\+oembed)?($|\s|;|,)/i', $media_type );
+ $cache[ $media_type ] = (bool) preg_match( '/(^|\s|,)application\/([\w!#\$&\-\^\.\+]+\+)?json(\+oembed)?($|\s|;|,)/i', $media_type );
}
return $cache[ $media_type ];
diff --git a/src/wp-includes/ms-files.php b/src/wp-includes/ms-files.php
index d17d9f95f7e35..497cc43e8083a 100644
--- a/src/wp-includes/ms-files.php
+++ b/src/wp-includes/ms-files.php
@@ -30,6 +30,11 @@
die( '500 — Directory not configured.' );
}
+if ( ! isset( $_GET['file'] ) || ! is_string( $_GET['file'] ) ) {
+ status_header( 404 );
+ die( '404 — File not found.' );
+}
+
$file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET['file'] );
if ( ! is_file( $file ) ) {
status_header( 404 );
diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php
index c11f00855cf0d..09990fd0d21e0 100644
--- a/src/wp-includes/nav-menu-template.php
+++ b/src/wp-includes/nav-menu-template.php
@@ -55,7 +55,7 @@
* numbered placeholders. Default is a ul with an id and class.
* @type string $item_spacing Whether to preserve whitespace within the menu's HTML.
* Accepts 'preserve' or 'discard'. Default 'preserve'.
- * }
+ * }
* @return void|string|false Void if 'echo' argument is true, menu output if 'echo' is false.
* False if there are no items or no menu was found.
*/
diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu.php
index 40612d5b8d937..2420a2583c82d 100644
--- a/src/wp-includes/nav-menu.php
+++ b/src/wp-includes/nav-menu.php
@@ -85,7 +85,7 @@ function is_nav_menu( $menu ) {
*
* @global array $_wp_registered_nav_menus
*
- * @param string[] $locations Associative array of menu location identifiers (like a slug) and descriptive text.
+ * @param array $locations Associative array of menu location identifiers (like a slug) and descriptive text.
*/
function register_nav_menus( $locations = array() ) {
global $_wp_registered_nav_menus;
@@ -734,12 +734,8 @@ function wp_get_nav_menu_items( $menu, $args = array() ) {
),
);
$args = wp_parse_args( $args, $defaults );
- if ( $menu->count > 0 ) {
- $items = get_posts( $args );
- } else {
- $items = array();
- }
+ $items = get_posts( $args );
$items = array_map( 'wp_setup_nav_menu_item', $items );
if ( ! is_admin() ) { // Remove invalid items only on front end.
diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
index 0aaeabbb3b9c0..30fa4b9814b58 100644
--- a/src/wp-includes/pluggable.php
+++ b/src/wp-includes/pluggable.php
@@ -1375,7 +1375,7 @@ function auth_redirect() {
* 2 if the nonce is valid and generated between 12-24 hours ago.
* False if the nonce is invalid. Only possible when `$action` is -1,
* as the function otherwise exits rather than returning false.
- * @phpstan-return ( $action is -1 ? int|false : int )
+ * @phpstan-return ( $action is -1 ? 1|2|false : 1|2 )
*/
function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
if ( -1 === $action ) {
@@ -1399,7 +1399,7 @@ function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
if ( ! $result && ! ( -1 === $action && str_starts_with( $referer, $adminurl ) ) ) {
wp_nonce_ays( $action );
- die();
+ die(); // @phpstan-ignore deadCode.unreachable (Stops a request with an invalid nonce even if a custom wp_die() handler returns.)
}
return $result;
@@ -1422,7 +1422,7 @@ function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
* 2 if the nonce is valid and generated between 12-24 hours ago.
* False if the nonce is invalid. Only possible when `$stop` is false,
* as the function otherwise exits rather than returning false.
- * @phpstan-return ( $stop is true ? int : int|false )
+ * @phpstan-return ( $stop is true ? 1|2 : 1|2|false )
*/
function check_ajax_referer( $action = -1, $query_arg = false, $stop = true ) {
if ( -1 === $action ) {
@@ -1841,17 +1841,30 @@ function wp_notify_postauthor( $comment_id, $deprecated = null ) {
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$comment_content = wp_specialchars_decode( $comment->comment_content );
+ /*
+ * Line breaks in the comment author fields would end the header or line they
+ * are placed in, letting the comment author add email headers or lines of their own.
+ */
+ $isolate_header_value = static function ( $value ): string {
+ $is_stringy = is_string( $value ) || ( is_object( $value ) && method_exists( $value, '__toString' ) );
+ $value = $is_stringy ? (string) $value : '';
+ return trim( (string) preg_replace( '/[\r\n]+/', ' ', $value ) );
+ };
+ $comment_author = $isolate_header_value( $comment->comment_author );
+ $comment_author_email = $isolate_header_value( $comment->comment_author_email );
+ $comment_author_url = $isolate_header_value( $comment->comment_author_url );
+
$wp_email = 'wordpress@' . preg_replace( '#^www\.#', '', wp_parse_url( network_home_url(), PHP_URL_HOST ) );
- if ( '' === $comment->comment_author ) {
+ if ( '' === $comment_author ) {
$from = "From: \"$blogname\" <$wp_email>";
- if ( '' !== $comment->comment_author_email ) {
- $reply_to = "Reply-To: $comment->comment_author_email";
+ if ( is_email( $comment_author_email ) ) {
+ $reply_to = "Reply-To: $comment_author_email";
}
} else {
- $from = "From: \"$comment->comment_author\" <$wp_email>";
- if ( '' !== $comment->comment_author_email ) {
- $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
+ $from = "From: \"$comment_author\" <$wp_email>";
+ if ( is_email( $comment_author_email ) ) {
+ $reply_to = "Reply-To: \"$comment_author_email\" <$comment_author_email>";
}
}
@@ -1886,9 +1899,9 @@ function wp_notify_postauthor( $comment_id, $deprecated = null ) {
/* translators: %s: Post title. */
$notify_message = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n";
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
- $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Trackback/pingback/comment author URL. */
- $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __( 'URL: %s' ), $comment_author_url ) . "\r\n";
/* translators: %s: Comment text. */
$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
$notify_message .= __( 'You can see all trackbacks on this post here:' ) . "\r\n";
@@ -1900,9 +1913,9 @@ function wp_notify_postauthor( $comment_id, $deprecated = null ) {
/* translators: %s: Post title. */
$notify_message = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n";
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
- $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Trackback/pingback/comment author URL. */
- $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __( 'URL: %s' ), $comment_author_url ) . "\r\n";
/* translators: %s: Comment text. */
$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
$notify_message .= __( 'You can see all pingbacks on this post here:' ) . "\r\n";
@@ -1914,11 +1927,14 @@ function wp_notify_postauthor( $comment_id, $deprecated = null ) {
/* translators: %s: Post title. */
$notify_message = sprintf( __( 'New note on your post "%s"' ), $post->post_title ) . "\r\n";
/* translators: 1: Note author's name, 2: Note author's IP address, 3: Note author's hostname. */
- $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Note author email. */
- $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
- /* translators: %s: Note text. */
- $notify_message .= sprintf( __( 'Note: %s' ), "\r\n" . ( empty( $comment_content ) ? __( 'resolved/reopened' ) : $comment_content ) ) . "\r\n\r\n";
+ $notify_message .= sprintf( __( 'Email: %s' ), $comment_author_email ) . "\r\n";
+ $notify_message .= sprintf(
+ /* translators: %s: Note text. */
+ __( 'Note: %s' ),
+ "\r\n" . ( empty( $comment_content ) ? __( 'resolved/reopened' ) : $comment_content )
+ ) . "\r\n\r\n";
$notify_message .= __( 'You can see all notes on this post here:' ) . "\r\n";
/* translators: Note notification email subject. 1: Site title, 2: Post title. */
$subject = sprintf( __( '[%1$s] Note: "%2$s"' ), $blogname, $post->post_title );
@@ -1928,11 +1944,11 @@ function wp_notify_postauthor( $comment_id, $deprecated = null ) {
/* translators: %s: Post title. */
$notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
/* translators: 1: Comment author's name, 2: Comment author's IP address, 3: Comment author's hostname. */
- $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Comment author email. */
- $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
+ $notify_message .= sprintf( __( 'Email: %s' ), $comment_author_email ) . "\r\n";
/* translators: %s: Trackback/pingback/comment author URL. */
- $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __( 'URL: %s' ), $comment_author_url ) . "\r\n";
if ( $comment->comment_parent && user_can( $post->post_author, 'edit_comment', $comment->comment_parent ) ) {
/* translators: Comment moderation. %s: Parent comment edit URL. */
@@ -2056,6 +2072,19 @@ function wp_notify_moderator( $comment_id ) {
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$comment_content = wp_specialchars_decode( $comment->comment_content );
+ /*
+ * Line breaks in the comment author fields would end the header or line they
+ * are placed in, letting the comment author add email headers or lines of their own.
+ */
+ $isolate_header_value = static function ( $value ): string {
+ $is_stringy = is_string( $value ) || ( is_object( $value ) && method_exists( $value, '__toString' ) );
+ $value = $is_stringy ? (string) $value : '';
+ return trim( (string) preg_replace( '/[\r\n]+/', ' ', $value ) );
+ };
+ $comment_author = $isolate_header_value( $comment->comment_author );
+ $comment_author_email = $isolate_header_value( $comment->comment_author_email );
+ $comment_author_url = $isolate_header_value( $comment->comment_author_url );
+
$message_headers = '';
/**
@@ -2093,9 +2122,9 @@ function wp_notify_moderator( $comment_id ) {
$notify_message = sprintf( __( 'A new trackback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
$notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
- $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Trackback/pingback/comment author URL. */
- $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __( 'URL: %s' ), $comment_author_url ) . "\r\n";
/* translators: %s: Trackback excerpt text. */
$notify_message .= sprintf( __( 'Trackback excerpt: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
break;
@@ -2105,9 +2134,9 @@ function wp_notify_moderator( $comment_id ) {
$notify_message = sprintf( __( 'A new pingback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
$notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
- $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Trackback/pingback/comment author URL. */
- $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __( 'URL: %s' ), $comment_author_url ) . "\r\n";
/* translators: %s: Pingback excerpt text. */
$notify_message .= sprintf( __( 'Pingback excerpt: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
break;
@@ -2117,11 +2146,11 @@ function wp_notify_moderator( $comment_id ) {
$notify_message = sprintf( __( 'A new comment on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
$notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
/* translators: 1: Comment author's name, 2: Comment author's IP address, 3: Comment author's hostname. */
- $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
+ $notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Comment author email. */
- $notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
+ $notify_message .= sprintf( __( 'Email: %s' ), $comment_author_email ) . "\r\n";
/* translators: %s: Trackback/pingback/comment author URL. */
- $notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
+ $notify_message .= sprintf( __( 'URL: %s' ), $comment_author_url ) . "\r\n";
if ( $comment->comment_parent ) {
/* translators: Comment moderation. %s: Parent comment edit URL. */
@@ -2477,6 +2506,8 @@ function wp_nonce_tick( $action = -1 ) {
* @return int|false 1 if the nonce is valid and generated between 0-12 hours ago,
* 2 if the nonce is valid and generated between 12-24 hours ago.
* False if the nonce is invalid.
+ *
+ * @phpstan-return 1|2|false
*/
function wp_verify_nonce( $nonce, $action = -1 ) {
$nonce = (string) $nonce;
diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php
index b35f7a994457d..9bef5f03e88e7 100644
--- a/src/wp-includes/plugin.php
+++ b/src/wp-includes/plugin.php
@@ -28,10 +28,10 @@
/** @var WP_Hook[] $wp_filter */
global $wp_filter;
-/** @var int[] $wp_actions */
+/** @var array $wp_actions */
global $wp_actions;
-/** @var int[] $wp_filters */
+/** @var array $wp_filters */
global $wp_filters;
/** @var string[] $wp_current_filter */
@@ -156,9 +156,9 @@ function add_filter( $hook_name, $callback, $priority = 10, $accepted_args = 1 )
* @since 6.0.0 Formalized the existing and already documented `...$args` parameter
* by adding it to the function signature.
*
- * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
- * @global int[] $wp_filters Stores the number of times each filter was triggered.
- * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
+ * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
+ * @global array $wp_filters Stores the number of times each filter was triggered.
+ * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the filter hook.
* @param mixed $value The value to filter.
@@ -213,9 +213,9 @@ function apply_filters( $hook_name, $value, ...$args ) {
* @see apply_filters() This function is identical, but the arguments passed to the
* functions hooked to `$hook_name` are supplied using an array.
*
- * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
- * @global int[] $wp_filters Stores the number of times each filter was triggered.
- * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
+ * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
+ * @global array $wp_filters Stores the number of times each filter was triggered.
+ * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the filter hook.
* @param non-empty-list $args The arguments supplied to the functions hooked to `$hook_name`.
@@ -413,10 +413,12 @@ function doing_filter( $hook_name = null ) {
*
* @since 6.1.0
*
- * @global int[] $wp_filters Stores the number of times each filter was triggered.
+ * @global array $wp_filters Stores the number of times each filter was triggered.
*
* @param string $hook_name The name of the filter hook.
* @return int The number of times the filter hook has been applied.
+ *
+ * @phpstan-return non-negative-int
*/
function did_filter( $hook_name ) {
global $wp_filters;
@@ -481,9 +483,9 @@ function add_action( $hook_name, $callback, $priority = 10, $accepted_args = 1 )
* @since 5.3.0 Formalized the existing and already documented `...$arg` parameter
* by adding it to the function signature.
*
- * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
- * @global int[] $wp_actions Stores the number of times each action was triggered.
- * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
+ * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
+ * @global array $wp_actions Stores the number of times each action was triggered.
+ * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the action to be executed.
* @param mixed ...$arg Optional. Additional arguments which are passed on to the
@@ -538,9 +540,9 @@ function do_action( $hook_name, ...$arg ) {
* @see do_action() This function is identical, but the arguments passed to the
* functions hooked to `$hook_name` are supplied using an array.
*
- * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
- * @global int[] $wp_actions Stores the number of times each action was triggered.
- * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
+ * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
+ * @global array $wp_actions Stores the number of times each action was triggered.
+ * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the action to be executed.
* @param list $args The arguments supplied to the functions hooked to `$hook_name`.
@@ -692,10 +694,12 @@ function doing_action( $hook_name = null ) {
*
* @since 2.1.0
*
- * @global int[] $wp_actions Stores the number of times each action was triggered.
+ * @global array $wp_actions Stores the number of times each action was triggered.
*
* @param string $hook_name The name of the action hook.
* @return int The number of times the action hook has been fired.
+ *
+ * @phpstan-return non-negative-int
*/
function did_action( $hook_name ) {
global $wp_actions;
diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php
index 4aa7f83ce8716..b609ee725f954 100644
--- a/src/wp-includes/post-template.php
+++ b/src/wp-includes/post-template.php
@@ -2052,6 +2052,8 @@ function wp_post_revision_title_expanded( $revision, $link = true ) {
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
* @param string $type 'all' (default), 'revision' or 'autosave'
+ *
+ * @phpstan-param 'all'|'revision'|'autosave' $type
*/
function wp_list_post_revisions( $post = 0, $type = 'all' ) {
$post = get_post( $post );
diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
index f8d5e0a383e81..4438594baeda3 100644
--- a/src/wp-includes/rest-api.php
+++ b/src/wp-includes/rest-api.php
@@ -454,7 +454,11 @@ function create_initial_rest_routes() {
* @global WP $wp Current WordPress environment instance.
*/
function rest_api_loaded() {
- if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) ) {
+ /*
+ * Admin screens call wp() for list queries; they are never REST entry points.
+ * Check WP_ADMIN rather than is_admin(), which follows the current screen.
+ */
+ if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) || defined( 'WP_ADMIN' ) ) {
return;
}
@@ -1550,6 +1554,8 @@ function rest_get_date_with_gmt( $date, $is_utc = false ) {
* @since 4.7.0
*
* @return int 401 if the user is not logged in, 403 if the user is logged in.
+ *
+ * @phpstan-return 401|403
*/
function rest_authorization_required_code() {
return is_user_logged_in() ? 403 : 401;
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
index f5739e6b3a3f3..3bb44059052eb 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
@@ -586,7 +586,7 @@ public function create_item_permissions_check( $request ) {
}
// Limit who can set comment `author`, `author_ip` or `status` to anything other than the default.
- if ( isset( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( 'moderate_comments' ) ) {
+ if ( isset( $request['author'] ) && get_current_user_id() !== $request['author'] && ! $this->check_assign_author_permission( $request['author'] ) ) {
return new WP_Error(
'rest_comment_invalid_author',
/* translators: %s: Request parameter. */
@@ -731,6 +731,14 @@ public function create_item( $request ) {
);
}
+ if ( 'note' === $request['type'] && $request['parent'] ) {
+ $parent_check = $this->check_note_parent( absint( $request['parent'] ), absint( $request['post'] ) );
+
+ if ( is_wp_error( $parent_check ) ) {
+ return $parent_check;
+ }
+ }
+
/*
* The canonical reaction key, populated once validated below so the
* stored content matches what was validated (not the raw input).
@@ -841,10 +849,12 @@ public function create_item( $request ) {
*
* Scope to active (approved) reactions only — trashed reactions
* are invisible to the user and must not block re-adding the
- * same emoji.
+ * same emoji. The same goes for a reaction stored on another
+ * post, which the reaction summary leaves out.
*/
$existing = get_comments(
array(
+ 'post_id' => absint( $request['post'] ),
'parent' => $request['parent'],
'user_id' => get_current_user_id(),
'type' => 'reaction',
@@ -1035,6 +1045,7 @@ public function create_item( $request ) {
if ( null !== $reaction_key ) {
$matching = get_comments(
array(
+ 'post_id' => absint( $request['post'] ),
'parent' => $request['parent'],
'user_id' => get_current_user_id(),
'type' => 'reaction',
@@ -1168,6 +1179,24 @@ public function update_item_permissions_check( $request ) {
);
}
+ /*
+ * Reassigning a comment copies the new author's email address onto it,
+ * which is then returned in the response.
+ */
+ if (
+ isset( $request['author'] ) &&
+ (int) $request['author'] !== (int) $comment->user_id &&
+ get_current_user_id() !== (int) $request['author'] &&
+ ! $this->check_assign_author_permission( $request['author'] )
+ ) {
+ return new WP_Error(
+ 'rest_comment_invalid_author',
+ /* translators: %s: Request parameter. */
+ sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'author' ),
+ array( 'status' => rest_authorization_required_code() )
+ );
+ }
+
/*
* check_edit_permission() above only establishes that the comment may be
* edited where it currently sits, because 'edit_comment' maps to 'edit_post'
@@ -1215,6 +1244,49 @@ public function update_item( $request ) {
);
}
+ if ( 'note' === $comment->comment_type ) {
+ $post_id = isset( $request['post'] ) ? absint( $request['post'] ) : (int) $comment->comment_post_ID;
+ $parent_id = isset( $request['parent'] ) ? absint( $request['parent'] ) : (int) $comment->comment_parent;
+ $is_moving = $post_id !== (int) $comment->comment_post_ID;
+
+ if ( $parent_id && ( $is_moving || $parent_id !== (int) $comment->comment_parent ) ) {
+ $parent_check = $this->check_note_parent( $parent_id, $post_id );
+
+ if ( is_wp_error( $parent_check ) ) {
+ return $parent_check;
+ }
+ }
+
+ // Replies and reactions stay on the note's post, so a move would separate them.
+ if ( $is_moving ) {
+ $children = get_comments(
+ array(
+ 'parent' => $id,
+ 'type' => array( 'note', 'reaction' ),
+ 'status' => 'any',
+ 'count' => true,
+ )
+ );
+
+ if ( $children ) {
+ return new WP_Error(
+ 'rest_comment_has_children',
+ __( 'A note with replies or reactions cannot be moved to another post.' ),
+ array( 'status' => 400 )
+ );
+ }
+ }
+ }
+
+ /*
+ * Re-sending the current author is a no-op. Otherwise the author's details
+ * would be refreshed from their user account, exposing any change to their
+ * email address to whoever can edit the comment.
+ */
+ if ( isset( $request['author'] ) && (int) $request['author'] === (int) $comment->user_id ) {
+ unset( $request['author'] );
+ }
+
$prepared_args = $this->prepare_item_for_database( $request );
if ( is_wp_error( $prepared_args ) ) {
@@ -1983,12 +2055,14 @@ public function get_item_schema() {
'parent' => array(
'description' => __( 'The ID for the parent of the comment.' ),
'type' => 'integer',
+ 'minimum' => 0,
'context' => array( 'view', 'edit', 'embed' ),
'default' => 0,
),
'post' => array(
'description' => __( 'The ID of the associated post object.' ),
'type' => 'integer',
+ 'minimum' => 0,
'context' => array( 'view', 'edit' ),
'default' => 0,
),
@@ -2162,7 +2236,8 @@ public function get_collection_params() {
'description' => __( 'Limit result set to comments of specific parent IDs.' ),
'type' => 'array',
'items' => array(
- 'type' => 'integer',
+ 'type' => 'integer',
+ 'minimum' => 0,
),
);
@@ -2347,26 +2422,27 @@ protected function prefetch_reaction_summaries( $note_ids ) {
$current_user_id = get_current_user_id();
- $parent_in = $wpdb->prepare(
- 'comment_parent IN (' . implode( ',', array_fill( 0, count( $note_ids ), '%d' ) ) . ')',
+ // Only reactions stored on their note's post count, which is what create_item() writes.
+ $from = "FROM $wpdb->comments AS r INNER JOIN $wpdb->comments AS n";
+ $from .= " ON n.comment_ID = r.comment_parent AND n.comment_post_ID = r.comment_post_ID AND n.comment_type = 'note'";
+ $where = "WHERE r.comment_type = 'reaction' AND r.comment_approved = '1' AND ";
+ $where .= $wpdb->prepare(
+ 'r.comment_parent IN (' . implode( ',', array_fill( 0, count( $note_ids ), '%d' ) ) . ')',
...$note_ids
);
// Query 1: Get aggregated counts per emoji per note.
- $query = "SELECT comment_parent, comment_content, COUNT(*) AS reaction_count FROM $wpdb->comments WHERE comment_type = 'reaction' AND comment_approved = '1' AND ";
- $query .= $parent_in;
- $query .= ' GROUP BY comment_parent, comment_content';
- // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
- $counts = $wpdb->get_results( $query );
+ $query = "SELECT r.comment_parent, r.comment_content, COUNT(*) AS reaction_count $from $where GROUP BY r.comment_parent, r.comment_content";
+ /** @var list