Repository navigation
HTTP API: Merge trunk and fix batch resend in WP_Http::request_multiple() - #98
Conversation
Rename the existing GET tests to satisfy the required `test_get_item()` and `test_get_items()` methods. Remove the empty placeholders while preserving their behavioral coverage. Developed in: WordPress#15919 Props rejaulalomkhan, rcwpdev. See #40538. git-svn-id: https://develop.svn.wordpress.org/trunk@65565 602fd350-edb4-49c9-b593-d223f7449a82
The per-identifier baselines were listed one by one in `phpstan.neon.dist`, between markers that `composer phpstan:baselines` rewrote whenever a baseline was added or deleted, so every change that retired a baseline edited the same lines and two such changes conflicted. They are now included through `tests/phpstan/baselines/loader.php`, a PHP configuration that returns the baselines found in its directory, since NEON can only include files by name. A baseline takes effect when it is added and stops when it is deleted, with no edit of the configuration. When regenerating, only the baselines being rewritten are suppressed: the generator passes their directory in the `WP_PHPSTAN_GENERATING_BASELINES` environment variable, and the loader there returns nothing. This works even when the configuration is included by another, such as a local `phpstan.neon`, which previously left every baseline in force and got them deleted. Baselines in other directories stay in force, so a stricter configuration with baselines of its own records only the errors the default ones do not cover. Developed in WordPress#16049. Follow-up to r63019, r63294, r65372. Props westonruter, apermo. See #65817. git-svn-id: https://develop.svn.wordpress.org/trunk@65566 602fd350-edb4-49c9-b593-d223f7449a82
Props xknown, dmsnell, jonsurrell, jeremyfelt. git-svn-id: https://develop.svn.wordpress.org/trunk@65567 602fd350-edb4-49c9-b593-d223f7449a82
…ewing. Props westonruter, lancewillett, johnbillion, xknown. git-svn-id: https://develop.svn.wordpress.org/trunk@65568 602fd350-edb4-49c9-b593-d223f7449a82
Props batmoo, xknown, jonsurrell. git-svn-id: https://develop.svn.wordpress.org/trunk@65569 602fd350-edb4-49c9-b593-d223f7449a82
Props xknown, jonsurrell, andrewserong. git-svn-id: https://develop.svn.wordpress.org/trunk@65570 602fd350-edb4-49c9-b593-d223f7449a82
Props villanovachile, peterwilsoncc, westonruter, johnbillion, jonsurrell, jeremyfelt. git-svn-id: https://develop.svn.wordpress.org/trunk@65571 602fd350-edb4-49c9-b593-d223f7449a82
Props jonsurrell, jsnajdr, jeryj. git-svn-id: https://develop.svn.wordpress.org/trunk@65572 602fd350-edb4-49c9-b593-d223f7449a82
Props jonsurrell, ntsekouras, westonruter, xknown, rfaile313, jorbin, jeremyfelt, ehtis. git-svn-id: https://develop.svn.wordpress.org/trunk@65573 602fd350-edb4-49c9-b593-d223f7449a82
Props xknown, westonruter, jeremyfelt. git-svn-id: https://develop.svn.wordpress.org/trunk@65574 602fd350-edb4-49c9-b593-d223f7449a82
Props xknown, jonsurrell, jeremyfelt. git-svn-id: https://develop.svn.wordpress.org/trunk@65575 602fd350-edb4-49c9-b593-d223f7449a82
Props rfaile313, westonruter, tyxla, lancewillett, xknown, jeremyfelt. git-svn-id: https://develop.svn.wordpress.org/trunk@65576 602fd350-edb4-49c9-b593-d223f7449a82
Props xknown, jonsurrell, jeremyfelt. git-svn-id: https://develop.svn.wordpress.org/trunk@65577 602fd350-edb4-49c9-b593-d223f7449a82
…n the admin. Props jorbin, ramonopoly, westonruter, adamsilverstein, jeremyfelt, rfaile313. git-svn-id: https://develop.svn.wordpress.org/trunk@65578 602fd350-edb4-49c9-b593-d223f7449a82
Props johnbillion, batmoo, jonsurrell, jeremyfelt, jorbin, xknown, rfaile313. git-svn-id: https://develop.svn.wordpress.org/trunk@65579 602fd350-edb4-49c9-b593-d223f7449a82
…ta_wp_context()`. Props jrf, gziolo, luisherranz, jonsurrell, lancewillett. git-svn-id: https://develop.svn.wordpress.org/trunk@65580 602fd350-edb4-49c9-b593-d223f7449a82
Props jsnajdr, johnbillion, jeryj, xknown. git-svn-id: https://develop.svn.wordpress.org/trunk@65581 602fd350-edb4-49c9-b593-d223f7449a82
Follow-up to [65570]. Props jeremyfelt. git-svn-id: https://develop.svn.wordpress.org/trunk@65582 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned commit hash of the Gutenberg repository from `61aba5422836aeed76a794f98d3fe0da3eb5f5d1` to `efd7722f89ebb8abfc3607fffdd86f5e34afbd9c`. A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@61aba54...efd7722. git-svn-id: https://develop.svn.wordpress.org/trunk@65583 602fd350-edb4-49c9-b593-d223f7449a82
git-svn-id: https://develop.svn.wordpress.org/trunk@65604 602fd350-edb4-49c9-b593-d223f7449a82
git-svn-id: https://develop.svn.wordpress.org/trunk@65606 602fd350-edb4-49c9-b593-d223f7449a82
Verify the expected output of `<meta name='referrer' content='strict-origin-when-cross-origin' />` tag. Developed in WordPress#15355. Props devmuhib, huzaifaalmesbah, lancewillett. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@65667 602fd350-edb4-49c9-b593-d223f7449a82
PHPStan analyzes all of core at rule level 5, but much of the code added in recent releases, such as the Abilities API and the AI client, already meets or nearly meets level 10. A second analysis now holds a selected set of paths to level 10, so that they cannot regress, and so that the set can grow as more files are brought up to that level, without raising the level for the entire project. PHPStan has no per-path rule levels, so the strict paths have a configuration of their own, `phpstan-strict.neon.dist`, which includes `phpstan.neon.dist`, replaces its paths with the strict ones, and scans the rest of core so that its symbols are known. Its baselines in `tests/phpstan/baselines-strict/` hold only what level 10 adds in the strict paths, since it includes the default baselines too. The two analyses are named "default" and "strict" rather than after their levels, since either level can be raised. The narrowed analysis relies on PHPStan 2.3.6, which no longer reports an ignored error as unmatched when its file is not analyzed. `composer phpstan` now runs both analyses. Also, `composer phpstan:baselines` and `composer phpstan:fix` handle both baseline directories. In CI, the two analyses run as parallel jobs, whose results are merged into the pull request comment. The headers of the default baselines change only to name the configuration they are regenerated with. Developed in WordPress#16021. Follow-up to r61699, r64539, r65372, r65537, r65566. Props westonruter, apermo. See #65817. git-svn-id: https://develop.svn.wordpress.org/trunk@65668 602fd350-edb4-49c9-b593-d223f7449a82
Give each test plugin a unique filename and limit its effects to requests carrying the test’s query parameter. Publish each plugin with an atomic rename and remove test plugins during global setup. Move the fatal error handler and login script localization specs to the parallel Playwright project. Developed in: WordPress#16037 Props adrianmoldovanwp, lucatume. See #66392. git-svn-id: https://develop.svn.wordpress.org/trunk@65669 602fd350-edb4-49c9-b593-d223f7449a82
Use `REST_TESTS_IMPOSSIBLY_HIGH_NUMBER` for the missing attachment in the audio and video widget tests. The test fixture itself can receive ID `777` and render media where the tests expect empty output. Developed in: WordPress#16092 Props johnbillion. See #66736. git-svn-id: https://develop.svn.wordpress.org/trunk@65670 602fd350-edb4-49c9-b593-d223f7449a82
Check the CSS and JavaScript directories in `wp-admin` and `wp-includes` for misplaced files. Allow the admin color scheme SCSS sources and the generated files under `wp-includes/build/`. Developed in: WordPress#13684 Props adrianmoldovanwp, mohamedahamed, lucatume, jorbin. See #65279. git-svn-id: https://develop.svn.wordpress.org/trunk@65673 602fd350-edb4-49c9-b593-d223f7449a82
Props kimclow. See #65860. git-svn-id: https://develop.svn.wordpress.org/trunk@65691 602fd350-edb4-49c9-b593-d223f7449a82
See #65860 git-svn-id: https://develop.svn.wordpress.org/trunk@65692 602fd350-edb4-49c9-b593-d223f7449a82
The 7.0 and 7.1 branches call `reusable-phpstan-static-analysis-v1.yml` from `trunk`. In r65668, that workflow began running `composer phpstan:default` and `composer phpstan:strict`, which only exist in `trunk`'s `composer.json`. Because of this, both of its jobs now fail immediately on those branches. This copies the current version of the workflow to `reusable-phpstan-static-analysis-v2.yml`, which `trunk` now calls, and restores `reusable-phpstan-static-analysis-v1.yml` to its state before r65668 for those branches. Follow-up to r65668. Reviewed by westonruter. Props desrosj, westonruter. Fixes #65817. git-svn-id: https://develop.svn.wordpress.org/trunk@65693 602fd350-edb4-49c9-b593-d223f7449a82
As of version 4.4.0, `src/jquery.form.js` in the `jquery-form` package is an ES module. Because `jquery-form` is registered as a classic script, browsers reject the file with a syntax error and `ajaxForm()` and `ajaxSubmit()` are not defined. This updates the relevant build scripts to copy `dist/jquery.form.js` instead, which is the package's UMD build and matches the format shipped before 4.4.0. Follow-up to r65541. Reviewed by davidbaumwald. Props prosenjitbarman. Fixes #66711. git-svn-id: https://develop.svn.wordpress.org/trunk@65694 602fd350-edb4-49c9-b593-d223f7449a82
Uses the default declared in a setting's `show_in_abilities` or `show_in_rest` schema when reading a setting that was never saved, rather than only the registered `default` argument. The registered default is still used when the schema declares none. The tests are updated to ensure schema defaults are returned for settings that were never saved. Developed in: WordPress#16062 Follow-up to r64311. Reviewed by peterwilsoncc. Props mukesh27, peterwilsoncc. Fixes #64605. git-svn-id: https://develop.svn.wordpress.org/trunk@65752 602fd350-edb4-49c9-b593-d223f7449a82
Introduces the new content for the 7.2 About page. Developed in: WordPress#16078 Props adamsilverstein, fcoveram, huzaifaalmesbah, mamaduka, markoserb, mosescursor, nazmul111, obenland, peterwilsoncc, sfougnier, trascaandrei, tusharaddweb, wildworks. Fixes #66202. git-svn-id: https://develop.svn.wordpress.org/trunk@65753 602fd350-edb4-49c9-b593-d223f7449a82
Require `SimpleXML` for the XML-only tests so an unavailable extension cannot end the PHPUnit run early with a successful exit code. Check the requirement before starting the isolated headers test. Keep checking JSON discovery links and filters on every build. Expect the XML discovery link only when `SimpleXMLElement` is available. Developed in: WordPress#16171 Props shanerounce. Fixes #66788. git-svn-id: https://develop.svn.wordpress.org/trunk@65754 602fd350-edb4-49c9-b593-d223f7449a82
Honor `WP_TESTS_SKIP_HTTP_LOOPBACK=1` when PHP cannot reserve a local TCP port. Continue running transport tests that do not need the fixture. If PHP reserves a port but the server fails to start, report the failure. Developed in: WordPress#16183 Props verygoode, tessory, amykamala, lucatume, adrianmoldovanwp. See #66794. git-svn-id: https://develop.svn.wordpress.org/trunk@65755 602fd350-edb4-49c9-b593-d223f7449a82
git-svn-id: https://develop.svn.wordpress.org/trunk@65756 602fd350-edb4-49c9-b593-d223f7449a82
Remove duplicate cleanup for ordinary post types. Use `unregister_post_type()` where the test needs a type to disappear before an assertion. Developed in: WordPress#15489, WordPress#15491, WordPress#15492, WordPress#15493, WordPress#15495, WordPress#15496 Props devmuhib, peterwilsoncc. See #66755. git-svn-id: https://develop.svn.wordpress.org/trunk@65757 602fd350-edb4-49c9-b593-d223f7449a82
git-svn-id: https://develop.svn.wordpress.org/trunk@65758 602fd350-edb4-49c9-b593-d223f7449a82
git-svn-id: https://develop.svn.wordpress.org/trunk@65759 602fd350-edb4-49c9-b593-d223f7449a82
git-svn-id: https://develop.svn.wordpress.org/trunk@65760 602fd350-edb4-49c9-b593-d223f7449a82
The test harness resets the private block-binding and category test taxonomies before the next test. Developed in: WordPress#15502, WordPress#15503 Props devmuhib, peterwilsoncc. See #66755. git-svn-id: https://develop.svn.wordpress.org/trunk@65761 602fd350-edb4-49c9-b593-d223f7449a82
Developed in WordPress#16215 Props johnbillion, sergeybiryukov, audrasjb See #66738 git-svn-id: https://develop.svn.wordpress.org/trunk@65764 602fd350-edb4-49c9-b593-d223f7449a82
Enable Playwright’s `list` reporter alongside the `github` reporter in CI so the job log names each test and retains GitHub annotations. Developed in: WordPress#16212 Props adrianmoldovanwp. See #66455. git-svn-id: https://develop.svn.wordpress.org/trunk@65767 602fd350-edb4-49c9-b593-d223f7449a82
Verify: - Injecting the relative `ajaxurl` for frontend requests while leaving `nonce` unset when logged out. - Injecting both `ajaxurl` and a valid `heartbeat-nonce` when a user is logged in. - Preserving any custom settings keys passed into the function. Developed in WordPress#15791. Props devmuhib, huzaifaalmesbah. See #66757. git-svn-id: https://develop.svn.wordpress.org/trunk@65768 602fd350-edb4-49c9-b593-d223f7449a82
This also updates `phpstan/phpstan-strict-rules` to 2.1.2. Both are bugfix releases, and neither changes what PHPStan reports for core, so the baselines are unchanged. Developed in WordPress#16186. Follow-up to r65265, r65537. See #66739. git-svn-id: https://develop.svn.wordpress.org/trunk@65769 602fd350-edb4-49c9-b593-d223f7449a82
The `WP_Theme_JSON::process_blocks_custom_css()` method is declared static, yet three of its call sites invoked it through `$this` while the others already used `static::`. Behavior is unchanged, since both forms resolve the method with late static binding. In Gutenberg the same change, made in WordPress/gutenberg#87058, cleared the only errors of the `dynamicCallOnStaticMethod` rule from phpstan-strict-rules, so making it here keeps `WP_Theme_JSON` in sync with its Gutenberg counterpart. Developed in WordPress#16093. Follow-up to r55192, r58421. Props noruzzaman, westonruter. See #66739. git-svn-id: https://develop.svn.wordpress.org/trunk@65770 602fd350-edb4-49c9-b593-d223f7449a82
In `_wp_scan_utf8()` the `$has_noncharacters` reference was accumulated with the bitwise `|=` operator, which turned the boolean into an integer as soon as a sequence able to encode a noncharacter was scanned, contrary to its documented type. It is now accumulated with a logical OR, so callers always receive a boolean. New `@param-out` tags document that `$has_noncharacters` and `$found_code_points` are never null on return, even though both accept null when passed in. This empties the `parameterByRef.unusedType` baseline, so it is removed. New tests cover how `_wp_scan_utf8()` counts code points across multibyte sequences and grapheme clusters, how it reports the maximal subparts of invalid byte sequences, and how it detects noncharacters. Developed in WordPress#14025. Follow-up to r61000, r63022. Props huzaifaalmesbah, dmsnell, lancewillett, westonruter, rcwpdev. See #66739. git-svn-id: https://develop.svn.wordpress.org/trunk@65771 602fd350-edb4-49c9-b593-d223f7449a82
The DataForm-based inspector requests the form config of the post type on load, so preload `/wp/v2/view-config` with `_fields=form`. Remove the preload of the post author user, which was only requested by the previous author panel. See WordPress/gutenberg#85081. Developed in WordPress#14494. Props ntsekouras, oandregal, mamaduka. Fixes #66339. git-svn-id: https://develop.svn.wordpress.org/trunk@65772 602fd350-edb4-49c9-b593-d223f7449a82
Only one of the unreachable statements in the baseline could never run, the trailing `wp_send_json_error()` in `wp_ajax_set_attachment_thumbnail()`, which would only have appended a second response after one had already been sent, and it is removed. The others are kept on purpose: * Translatable strings after a `return`, so that they are added to the POT file. * An `exit` or `break` that keeps a `switch` case from reading as falling through. * The `wp_die()` fallback for a list table supplied by the `wp_list_table_class_name` filter whose `ajax_response()` returns. * The `die()` that stops a request with an invalid nonce even if a custom `wp_die()` handler returns. Since these should never be fixed, they are ignored inline with a reason rather than left in a baseline, which would invite contributors to remove them. Unlike the counted entries used for the HTML API in r64294, an inline ignore names the exact statement, so a genuine unreachable statement added to the same file is still reported. The Ajax handlers involved are also documented as never returning. Developed in WordPress#16224. Follow-up to r29029, r63023, r64294. Props mukesh27, westonruter. See #66739. git-svn-id: https://develop.svn.wordpress.org/trunk@65773 602fd350-edb4-49c9-b593-d223f7449a82
Some translator comments were placed in front of a ternary operator or shared a line with several translatable strings. String extraction tools either miss such comments or attach them to the wrong string. This moves each comment directly before the gettext call it describes. Developed in: WordPress#16069 Props swissspidy, mukesh27. See #66747. git-svn-id: https://develop.svn.wordpress.org/trunk@65774 602fd350-edb4-49c9-b593-d223f7449a82
Some translator comments were placed in front of a ternary operator or shared a line with several translatable strings. String extraction tools either miss such comments or attach them to the wrong string. This moves each comment directly before the gettext call it describes. This is the bundled themes counterpart of r65774, which fixes the same problem in core. Developed in: WordPress#16071 Props swissspidy, mukesh27. See #66747. git-svn-id: https://develop.svn.wordpress.org/trunk@65775 602fd350-edb4-49c9-b593-d223f7449a82
Narrow integer return and parameter types to ranges such as `non-negative-int` and `positive-int`, and string and integer types to the literal values a function can actually take or return, so that static analysis can catch more mistakes. Developed in: WordPress#13893 Props swissspidy, westonruter, marian1. See #66739. git-svn-id: https://develop.svn.wordpress.org/trunk@65776 602fd350-edb4-49c9-b593-d223f7449a82
Document the known keys of arrays that functions accept or return as array shapes, such as the HTTP API response, which is defined once on `WP_Http` and reused by the remote request functions, and the widget, robots, and admin helper arrays. This lets static analysis check how the values are used. Developed in: WordPress#13894 Props swissspidy, westonruter, marian1, johnbillion. See #66739. git-svn-id: https://develop.svn.wordpress.org/trunk@65777 602fd350-edb4-49c9-b593-d223f7449a82
# Conflicts: # src/wp-includes/class-wp-http.php
`WP_Http::request_multiple()` caught every exception thrown while sending a batch and then sent each request of the batch again, one by one. Such an exception can come from a callback on a hook that fires after the requests were sent, so non-idempotent requests could be sent twice, and exceptions unrelated to the Requests library were swallowed. Reject non-HTTP(S) URLs per request up front instead, with the same error that `Requests::request()` throws, and report a Requests exception thrown for the batch as the error of each of its requests without resending them. Also fire the `requests.before_request` hook for each batched request, as `Requests::request()` does for a single request but `Requests::request_multiple()` does not. See #37459. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UWTd5pYrbbBoL1571AjtuT
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
c591e4f
into
trac-37459-http-request-multiple
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Follow-up for WordPress#13657. Merging this fast-forwards
trac-37459-http-request-multiple.trunk. Resolves the conflict with trunk's newHTTP_ResponsePHPStan type inclass-wp-http.php: the PR'sResponsealias is dropped in favor of trunk'sHTTP_Response, andPrepared_Requestis kept.WP_Http::request_multiple()caught anyExceptionthrown byRequests::request_multiple()and then re-sent every request in the batch one by one. Plugin callbacks onhttp_api_curl,requests-curl.before_multi_execorrequests-curl.after_multi_execcan throw after the transfers have finished, so a POST could go out twice. Exceptions unrelated to the Requests library were also swallowed. Now, non-HTTP(S) URLs are rejected per request up front, with the samenonhttperror thatRequests::request()throws. AWpOrg\Requests\Exceptionthrown for the batch becomes the error for each of its requests, and nothing is re-sent. Other exceptions propagate, as they do forrequest().requests.before_requestfor each batched request.Requests::request()fires this hook butRequests::request_multiple()doesn't, sorequests-requests.before_requestcallbacks were silently skipped for batched requests.Trac ticket: https://core.trac.wordpress.org/ticket/37459
Use of AI Tools
Review, merge resolution, fix and tests written with Claude Code. The PHPUnit suite was not run in the authoring environment (no Composer dependencies or database). Both changed files pass
php -l.Generated by Claude Code