Skip to content

Judge the pattern for the analysed PHP, not the running one - #3

Closed
yoeunes wants to merge 1 commit into
walk-the-phpregex-astfrom
judge-pattern-validity-for-the-analysed-engine
Closed

yoeunes wants to merge 1 commit into
walk-the-phpregex-astfrom
judge-pattern-validity-for-the-analysed-engine

Conversation

@yoeunes

@yoeunes yoeunes commented Oct 23, 2026

Copy link
Copy Markdown
Member

Stacked on #1 and #2 — review those first.

What

The pre-check that gated unreadable patterns compiled them on the running engine. A construct the runner takes but the analysed PHP predates kept its shapes: a padded \x{ 41 } on a project analysed for PHP 8.2 (PCRE2 10.40) read as the letter x then text, when the engine that project actually runs refuses the pattern outright.

The reader now validates for the target it reads for — PHPRegexReader::accepts() — so:

  • pattern the analysed engine refuses → no shape (falls back to the broad array<string>), whatever the runner thinks;
  • the RegularExpressionPatternRule keeps reporting on the running engine, as it always did — each part of the pipeline names its own judge.

This closes the open point recorded in #1's review notes.

Test plan

  • new pin: padded escape → null shape for PHP 8.2, non-constant shape for 8.4
  • the resolver suite: 1873/1873

@yoeunes
yoeunes force-pushed the walk-the-phpregex-ast branch 2 times, most recently from 40a0270 to c3b490f Compare October 23, 2026 18:29
@yoeunes
yoeunes force-pushed the judge-pattern-validity-for-the-analysed-engine branch from 570449f to 9952049 Compare October 23, 2026 18:37
The pre-check that gated unreadable patterns compiled them on the
running engine, so a construct the runner takes but the analysed PHP
predates kept its shapes — a padded \x{ 41 } on a project pinned to
PHP 8.2 read as the letter x then text instead of carrying no shape at
all. The reader validates for the target it reads for, the engine that
answers is the one the project runs, and the invalid-pattern rule keeps
speaking for the running engine as it always did — each part of the
pipeline names its own judge.
@yoeunes
yoeunes force-pushed the walk-the-phpregex-ast branch from c3b490f to fe67a32 Compare October 23, 2026 19:43
@yoeunes
yoeunes force-pushed the judge-pattern-validity-for-the-analysed-engine branch from 9952049 to 9cfff24 Compare October 23, 2026 19:45
@yoeunes

yoeunes commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Folded into #1: the stack now travels as one pull request while the series is being built. The branch content is unchanged — read-regex-shapes-through-phpregex points at the same commits.

@yoeunes yoeunes closed this Oct 23, 2026
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