Skip to content

Update m4 check for libpcre2 version #19289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: PHP-8.3
Choose a base branch
from

Conversation

hashar
Copy link

@hashar hashar commented Jul 29, 2025

The pcre extension automake configuration only requires libpcre2 10.30. PHP 8.2 requires 10.42 else on startup one would encounter:

Warning: PHP Startup: ^(text/|application/xhtml+xml) (offset=0): unrecognised
compile-time option bit(s) in Unknown on line 0

Most people use the bundled libpcre2. When one uses a dynamically linked version of libpcre2, the pcre extension has an outdated version requirement:

ext/pcre/config0.m4: PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])

That was introduced by a5bc5ae (released with php 7.30) which came with libpcre2 10.30.

If one backports php 8.3 to an older version of Debian (Bullseye has 10.36), the compilation configuration checks pass but the PHP startup warning will appear.

The bundled version of libpcre2 has been updated several time and the version check was never kept in sync:

PHP libpcre2 commit
7.3.0 10.30 a5bc5ae
7.3.0 10.31 703e037
7.4.0 10.32 d918e07
7.4.0 10.33 aa9433e
8.0.0 10.34 52d0783
8.0.0 10.35 b419f96
8.1.0 10.37 5d42900
8.1.1 10.39 6008a75
8.2.0 10.40 32cceb7
8.3.0 10.42 c4e8f65
8.4.0 10.43 ae5beff
8.4.0 10.44 d1f14a4
8.5.x 10.45 e928487

The requirement did not:

$ git grep libpcre {PHP-{7.4,8.0,8.1,8.2,8.3,8.4},master} ext/pcre/config0.m4
PHP-7.4:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.0:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.1:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.2:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.3:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.4:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
master:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])

Update the m4 macro libpre2-8 requirement from 1.30 to 10.42.

References:

The pcre extension automake configuration only requires libpcre2 10.30. PHP 8.2
requires 10.42 else on startup one would encounter:

  Warning: PHP Startup: ^(text/|application/xhtml\+xml) (offset=0): unrecognised
  compile-time option bit(s) in Unknown on line 0

Most people use the bundled libpcre2. When one uses a dynamically linked version
of libpcre2, the pcre extension has an outdated version requirement:

  ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])

That was introduced by a5bc5ae (released with
php 7.30) which came with libpcre2 10.30.

If one backports php 8.3 to an older version of Debian (Bullseye has 10.36),
the compilation configuration checks pass but the PHP startup warning will
appear.

The bundled version of libpcre2 has been updated several time and the version
check was never kept in sync:

| PHP   | libpcre2 | commit
|-------|----------|-------
| 7.3.0 | 10.30    | a5bc5ae
| 7.3.0 | 10.31    | 703e037
| 7.4.0 | 10.32    | d918e07
| 7.4.0 | 10.33    | aa9433e
| 8.0.0 | 10.34    | 52d0783
| 8.0.0 | 10.35    | b419f96
| 8.1.0 | 10.37    | 5d42900
| 8.1.1 | 10.39    | 6008a75
| 8.2.0 | 10.40    | 32cceb7
| 8.3.0 | 10.42    | c4e8f65
| 8.4.0 | 10.43    | ae5beff
| 8.4.0 | 10.44    | d1f14a4
| 8.5.x | 10.45    | e928487

The requirement did not:
```
$ git grep libpcre {PHP-{7.4,8.0,8.1,8.2,8.3,8.4},master} ext/pcre/config0.m4
PHP-7.4:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.0:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.1:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.2:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.3:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
PHP-8.4:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
master:ext/pcre/config0.m4:  PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
```

Update the m4 macro libpre2-8 requirement from 1.30 to 10.42.

References:
* https://phabricator.wikimedia.org/T398245#11010808
* https://phabricator.wikimedia.org/T400693
@hashar hashar changed the base branch from master to PHP-8.3 July 29, 2025 13:28
@hashar
Copy link
Author

hashar commented Jul 29, 2025

PHP 7.3, 7.4, 8.0, 8.1 and 8.2 are also affected but according to https://www.php.net/supported-versions.php they are no more supported.

I believe the PHP-8.4 branch would need to bump the requirement to 10.44 and master/php 8.5, would need libpcre2 10.45.

For the maintainers: whenever the bundled version is updated, the m4 macro should be adjusted as well :)

@DanielEScherzer
Copy link
Member

DanielEScherzer commented Jul 29, 2025

@hashar CI does not run again when the target branch of a PR changes (and we don't have an equivalent of your (WMF zuul) recheck command) - would you mind force-pushing this an updated commit or something so that the HEAD changes and we can run our CI?

@nielsdos
Copy link
Member

Thing is, PHP 8.3 etc still work fine with pcre2lib 10.30, I just tried and there is no warning.
Compiling with a more modern pcre2 headers and then dynamically loading a system version that is older will always go wrong with every library dependency we have.

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.

3 participants