Skip to content

Avoid mbregex retry failures while trimming - #31

Merged
vanderlee merged 4 commits into
agent/modernize-test-matrixfrom
agent/fix-issue-27-unicode-trim
Aug 3, 2026
Merged

vanderlee merged 4 commits into
agent/modernize-test-matrixfrom
agent/fix-issue-27-unicode-trim

Conversation

@vanderlee

Copy link
Copy Markdown
Owner

What changed

  • Replace the anchored mb_ereg_replace() trim expression with Unicode-aware PCRE trimming.
  • Guarantee a string result by falling back to PHP's byte-oriented trim() only when PCRE rejects malformed input.
  • Add coverage for non-breaking spaces and very long leading/trailing whitespace.

Why

Issue #27 reports mb_ereg_replace() exhausting the mbregex retry limit and returning false, which then breaks sentence processing. Trimming only the two string boundaries does not require the stateful mbregex search engine.

Dependency

This is a stacked draft based on PR #30 so the regression suite runs on the replacement GitHub Actions matrix. After PR #30 merges, this PR can be retargeted to master.

Closes #27.

@vanderlee
vanderlee marked this pull request as ready for review August 3, 2026 19:36
@vanderlee
vanderlee merged commit 73377ba into agent/modernize-test-matrix Aug 3, 2026
6 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.

1 participant