Skip to content

Test support for libpcre2 10.47 - #20397

Closed
orlitzky wants to merge 1 commit into
php:PHP-8.3from
orlitzky:test-support-for-libpcre2-10.47
Closed

Test support for libpcre2 10.47#20397
orlitzky wants to merge 1 commit into
php:PHP-8.3from
orlitzky:test-support-for-libpcre2-10.47

Conversation

@orlitzky

@orlitzky orlitzky commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

In the latest version of libpcre2, the offsets appearing in some "compilation failed" warnings have increased by one due to PCRE2Project/pcre2#756. This is causing spurious test failures, so in this commit we replace the hard-coded offsets by %d to match any integer.

An example failure:

---- EXPECTED OUTPUT
Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line %d
...
---- ACTUAL OUTPUT
Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 1 in /var/tmp/portage/dev-lang/php-8.4.13/work/php-8.4.13/ext/pcre/tests/grep2.php on line 3

This was originally reported as https://bugs.gentoo.org/965018

@orlitzky

orlitzky commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

(Sorry, I forgot to rebase on 8.3 before opening the PR and confused the hell out of the label/review bot.)

@iluuu1994 iluuu1994 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Assuming the change in libpcre2 is intentional.

Comment thread ext/pcre/tests/grep2.phpt Outdated
@@ -21,7 +21,7 @@ var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR);

?>
--EXPECTF--
Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line %d
Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset %d in %sgrep2.php on line %d

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe use %r(0|1)%r instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because I forgot about %r :)

Done!

@orlitzky

orlitzky commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

It was intentional, I went digging: PCRE2Project/pcre2#756

@orlitzky
orlitzky force-pushed the test-support-for-libpcre2-10.47 branch from cfd8972 to 245b796 Compare November 5, 2025 19:15
In the latest version of libpcre2, the offsets appearing in some
"compilation failed" warnings have increased by one, as a result of

  PCRE2Project/pcre2#756

This is causing spurious test failures, so in this commit we replace
the hard-coded offsets by a regex that matches both values.

Gentoo-bug: https://bugs.gentoo.org/965018
@orlitzky
orlitzky force-pushed the test-support-for-libpcre2-10.47 branch from 245b796 to 5f61eeb Compare November 5, 2025 19:15
@iluuu1994 iluuu1994 closed this in bdf62b5 Nov 7, 2025
@iluuu1994

Copy link
Copy Markdown
Member

Thank you @orlitzky!

adrian-enspired pushed a commit to adrian-enspired/php-src that referenced this pull request Aug 4, 2026
In the latest version of libpcre2, the offsets appearing in some
"compilation failed" warnings have increased by one, as a result of

  PCRE2Project/pcre2#756

This is causing spurious test failures, so in this commit we replace
the hard-coded offsets by a regex that matches both values.

Gentoo-bug: https://bugs.gentoo.org/965018

Closes phpGH-20397
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants