Cast maximum post length to integer to prevent TypeError - #1120
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused cast resolves the reported PHP 8 TypeError with comprehensive regression coverage.
Pull request overview
Prevents cron formatting crashes by normalizing persisted maximum post lengths before arithmetic.
Changes:
- Casts
maximum_lengthto an integer. - Adds regression coverage for invalid and valid length values.
- Registers the new PHPUnit suite.
File summaries
| File | Description |
|---|---|
includes/admin/helpers/class-rop-post-format-helper.php |
Normalizes maximum length before use. |
tests/test-post-format-max-length.php |
Tests empty, numeric, integer, and negative lengths. |
phpunit.xml |
Registers the regression suite. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Review agent — review posted ✅
Run |
pirate-bot
left a comment
There was a problem hiding this comment.
Approved: The integer cast prevents invalid persisted lengths from crashing content formatting.
The focused regression suite passed all six tests on PHP 8.3 and PHPUnit 9.6.19.
Validation details
- The WordPress 7.1 test environment passed 6 tests with 18 assertions.
- The caller trace confirmed persisted values reach
build_content()through the queue formatter. - The changed cast introduced no security boundary flaw.
Untested areas
- Full suites, linters, builds, browser checks, and other PHP versions remain with CI.
🤖 Automated review · run code-review-agent_6aa1617ca4a139.06820020.
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: pirate-bot <58979018+pirate-bot@users.noreply.github.com>
# Conflicts: # assets/js/build/dashboard.js # phpunit.xml Co-authored-by: pirate-bot <58979018+pirate-bot@users.noreply.github.com>
Done — I merged |
Summary
Ensures that the
maximum_lengthvalue is always cast to an integer before use, preventing the error.Check before Pull Request is ready:
Closes #1108