Repository navigation
Validated profiler payload structure - #1214
Conversation
There was a problem hiding this comment.
🟢 Approved
This approves the schema fix, and the notes ask you to check one new test and one helper the endpoint now reaches.
inc/rest.php:1006—noteA request withoutbnow gets the default[]and reachesget_background_lazyload_selectors(). Before, it stopped at a fatal error first. That helper once failed with "Call to a member function get() on null" (#1020). Source shows it returns[]when settings are missing (inc/lazyload_replacer.php:118-121). Please confirm that settings are never missing on this route after the helper returns. If they are, the old fatal error is back.
Validation details
- Files reviewed: 3/3 changed files. The history row "issue #1020: Call to a member function get() on null in lazyload_replacer.php:118" stayed unchecked.
- The
Test_Rest_Optimizationsclass passes at HEAD on WordPress 7.1.4 and PHP 8.3.36cd /repo; set -o pipefail; timeout 280 vendor/bin/phpunit --do-not-cache-result --filter 'Test_Rest_Optimizations::' --t…(run R4, exit 0). - Payloads shaped like the bundled profiler's output return 200 and are stored
cd /workspace/checks/C7 && sed -i 's/class C7_Payload_Shapes_Test/class C7PayloadTest/' C7PayloadTest.php && cd /repo &&…(run R13, exit 0). - PHPStan reports no errors in
inc/rest.phpcd /repo; timeout 110 vendor/bin/phpstan analyse --memory-limit=-1 --no-progress --error-format=raw 2>&1 | grep -c "rest…(run R6, exit 0). - The security pass found no new boundary effect. The HMAC, origin and count limits are unchanged.
Untested areas
- The live profiler output was not captured in a browser. The payload shapes come from source and Git history.
- The history row "issue #1020: Call to a member function get() on null in lazyload_replacer.php:118" stayed unchecked. A note covers it.
🤖 Automated review · run code-review-agent_6ae32cdfb81236.09378042.
🤖 Review agent — review posted ✅ on 23f42967 · approved · 0 findings · 32 min
Run code-review-agent_6ae32cdfb81236.09378042 · trail
Not a new exposure: every request from the bundled profiler already sends |
There was a problem hiding this comment.
🟢 Approved
This approves the change because the only new commit removes the test that passed on the base code.
Validation details
- Files reviewed: 3/3 changed files. Only
tests/test-rest-optimizations.phpchanged since the last review. - The new commit deletes one test method. The remaining tests and their helpers are intact at HEAD.
Test_Rest_Optimizationspassed on WordPress 7.1.4 and PHP 8.3.36. Source: run code-review-agent_6ae32cdfb81236.09378042, R4, not rerun.- PHPStan and the security pass found no issue in
inc/rest.php. Source: the same run, not rerun. That file is unchanged since then.
Untested areas
- The test suite was not rerun at HEAD. The only change is one deleted test method.
🤖 Automated review · run code-review-agent_6ae335db2d6658.32655223.
🤖 Review agent — review posted ✅ on 2299a551 · approved · 0 findings · 5 min
Run code-review-agent_6ae335db2d6658.32655223 · trail
|
🎉 This PR is included in version 4.2.18 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
Fixed PHP 8 TypeErrors in public
optml/v1/optimizationsendpoint by adding REST schemas forb,l[u], andm, allowing WordPress to validate incoming data before the handler runs. Missing background-selector data now defaults to an empty array, nestednullURL lists are normalized to empty arrays to preserve profiles sent by the bundled profiler, and other invalid data types return a400 rest_invalid_paramresponse instead of causing an HTTP 500.Closes #1204
Other information: