Page MenuHomePhabricator

PHP package must raise libpcre version requirement
Open, LowPublic

Description

When we package a newer version of PHP and deploy, it we encountered at least twice some warning:

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

This is caused by using an older version of libpcre than the one expected by PHP. php 8.2 and 8.3 require libpcre2 10.42 which comes bundled with PHP. On Debian however, libpcre2 is dynamically linked to use the system wide version: Bookworm has 10.42, but a backport of PHP to Bullseye would use 10.36 which leads to the issue.

When investigating (T398245#11010808), I found our package had Depends-On: libpcre>=10.32 and the PHP 8.3 sources did not update the requirement:

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

Even if we have libpcre2 in the same apt component used by php, it is not getting upgraded if it already got installed. We thus need to raise the requirement to cause apt to upgrade the package. This task is to request our php 8.3 package to match upstream expectation and set `Depends-On: libpcre2-8==10.42). Alternatively, we could use the bundled version.

The issue affects any downstream usage of the PHP package (CI images, dev images, deployment-prep) and has happened with the php 8.1 packages T387276 and again with the php 8.3 ones T398245#11010808

Event Timeline

I have sent a patch to upstream so that PHP config scripts would complain when an outdated version of libpcre2 is used: https://github.com/php/php-src/pull/19289

For our PHP package, I could not find where our fork is maintained (I could not find anything in Gerrit or in Gitlab). I assuming the sources are solely on the Debian packaging build hosts, and I thus can't offer a patch to bump Depends-On ;)

Thanks for writing this up, @hashar.

As we've discussed, the tricky part here is how that Depends comes to be in the resulting package, by way of expanding the ${shlibs:Depends} in the control file with dh_shlibdeps (i.e., via symbol versioning). This is a case where the set of referenced symbols alone is insufficient to capture some form of backward incompatibility between 10.36 and 10.42 introduced at compile time (e.g., header differences).

In any case, I'll take a look at what's possible, but in the interim, the workaround remains the same as it was during the 8.1 migration: include libpcre2-8-0 in the list of installed packages when installing php (i.e., after adding component/php83).

JMeybohm edited projects, added: ServiceOps; removed: serviceops-deprecated.
JMeybohm moved this task from Inbox to Backlog on the ServiceOps board.