Skip to content

Cast maximum post length to integer to prevent TypeError - #1120

Merged
pirate-bot merged 3 commits into
developmentfrom
bugfix/1108
Sep 14, 2026
Merged

pirate-bot merged 3 commits into
developmentfrom
bugfix/1108

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Summary

Ensures that the maximum_length value is always cast to an integer before use, preventing the error.

Check before Pull Request is ready:

Closes #1108

@pirate-bot

pirate-bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Plugin build for b8fe710 is ready 🛎️!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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_length to 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.

@pirate-bot

pirate-bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🤖 Review agent — review posted ✅

Run code-review-agent_6aa1617ca4a139.06820020 · trail

@pirate-bot pirate-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pirate-bot

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Copilot AI and others added 2 commits September 14, 2026 19:05
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>

Copilot AI commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Done — I merged development into this branch and resolved the conflicts in commit b8fe7107.

Copilot AI requested a review from pirate-bot September 14, 2026 19:07
@pirate-bot
pirate-bot merged commit ae122ea into development Sep 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron crashes when post format maximum length is non-numeric

5 participants