Fix PHP_EXTRA_VERSION setting

Bug #1989196 reported by Athos Ribeiro
18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php
Unknown
Unknown
php7.4 (Ubuntu)
Invalid
Undecided
Unassigned
Focal
Fix Released
Undecided
Athos Ribeiro
php8.1 (Ubuntu)
Fix Released
Undecided
Athos Ribeiro
Jammy
Fix Released
Undecided
Athos Ribeiro
Kinetic
Fix Released
Undecided
Athos Ribeiro
php8.2 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

[ Impact ]

Until bionic, the PHP_VERSION variable and the `php --version` command output included the deb version as a suffix of the release (e.g., 7.2.20-1ubuntu2).

From focal and on, a change in the upstream configure.ac file was not accounted for in d/rules, introducing a regression.

Now, users can no longer tell if a specific php release contains a certain fix from within PHP just by parsing the internal version defined in PHP_VERSION.

[ Test Plan ]

There is a autopkgtest being proposed with this change that covers the testing for this SRU (debian/tests/version).

The idea is to compare the full deb package version string with the one in the "php --version" output. A fixed patch should show the same for both. The following script extracted from d/t/version should cover it (for focal, substitute the php version when checking/using the cli package):

#!/bin/sh
PKGVERSION=$(dpkg-query --showformat='${Version}\n' --show php8.1-cli)
PHPVERSION=$(php8.1 --version | head -1 | cut -d ' ' -f2)

if [ "${PKGVERSION}" != "${PHPVERSION}" ]; then
 echo "package version '${PKGVERSION}' does not match php CLI version '${PHPVERSION}'"
 exit 1
fi

[ Where problems could occur ]

This changes the output of "php --version" and the value set for the PHP_VERSION variable. This means that any program parsing the php version, either internally through php, or by parsing the output of `php --version`, and not accounting for possible string contents in the debian version part of the package version (e.g., -1ubuntu3 or -1ubuntu3~something) will possibly crash and will need to be adjusted.

[ Other Info ]

This is already fixed in kinetic.

While the jammy SRU will be useful to identify the previous SRU, which is specially valuable for the drupal community, the focal SRU has lower priority and therefore we should stage it (block in proposed).

[ Original message ]

The PHP_EXTRA_VERSION constant is configured in debian/rules, but the sed substitution performed in such line no longer applies since PHP 7.4 (focal).

It currently looks for
PHP_EXTRA_VERSION=""
which was available at:
https://github.com/php/php-src/blob/php-7.2.34/configure.ac#L111

Now, when we look at
https://github.com/php/php-src/blob/php-7.4.30/configure.ac#L117
we see
PHP_EXTRA_VERSION=[$]4

Which is why the following sed command, present in d/rules, no longer applies:
$(SED) -i -e 's/EXTRA_VERSION=""/EXTRA_VERSION="-$(PHP_DEBIAN_REVISION)"/' configure.ac

The fix here seems to be straightforward and should provide means for third party software to detect whether a specific Ubuntu PHP version carries certain features or fixes. ATM, this will be specially useful for Drupal to detect if PHP8.1 < 8.1.6 (i.e., jammy's PHP) carries an OPCache fix, introduced in LP: #1983205

Related branches

no longer affects: php7.4 (Ubuntu Jammy)
no longer affects: php7.4 (Ubuntu Kinetic)
no longer affects: php8.1 (Ubuntu Focal)
Changed in php7.4 (Ubuntu):
status: New → Invalid
Changed in php8.1 (Ubuntu Kinetic):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
Changed in php8.1 (Ubuntu Jammy):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
Changed in php7.4 (Ubuntu Focal):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
tags: added: server-todo
Changed in php8.1 (Ubuntu Kinetic):
status: New → In Progress
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php8.1 - 8.1.7-1ubuntu3

---------------
php8.1 (8.1.7-1ubuntu3) kinetic; urgency=medium

  * d/rules: fix PHP_EXTRA_VERSION setting. (LP: #1989196)
  * Test PHP_EXTRA_VERSION setting with autopkgtest.

 -- Athos Ribeiro <email address hidden> Tue, 13 Sep 2022 11:02:34 -0300

Changed in php8.1 (Ubuntu Kinetic):
status: In Progress → Fix Released
description: updated
description: updated
Changed in php8.1 (Ubuntu Jammy):
status: New → In Progress
Changed in php7.4 (Ubuntu Focal):
status: New → In Progress
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Athos, or anyone else affected,

Accepted php8.1 into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/php8.1/8.1.2-1ubuntu2.6 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in php8.1 (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-jammy
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Testing with current php version in jammy:

# php --version
PHP 8.1.2 (cli) (built: Aug 8 2022 07:28:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

Testing with -proposed php version:

# php --version
PHP 8.1.2-1ubuntu2.6 (cli) (built: Sep 15 2022 11:30:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.6, Copyright (c), by Zend Technologies

Ths is now verified.

tags: added: verification-done-jammy
removed: verification-needed-jammy
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (php8.1/8.1.2-1ubuntu2.6)

All autopkgtests for the newly accepted php8.1 (8.1.2-1ubuntu2.6) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

php-luasandbox/4.0.2-3build1 (arm64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#php8.1

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

The failing test above was a flaky one. I re-triggered it and it passed.

Revision history for this message
Kraut.Hosting (kraut.hosting) wrote :

@Athos Bom dia :) Awesome work you're doing!

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Bom dia!!

Thanks all the help, reports, and feedback!

Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Athos, or anyone else affected,

Accepted php7.4 into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/php7.4/7.4.3-4ubuntu2.14 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in php7.4 (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed-focal
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Testing with current php version in focal:

# php --version
PHP 7.4.3 (cli) (built: Aug 17 2022 13:29:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Testing with -proposed php version:

# php --version
PHP 7.4.3-4ubuntu2.14 (cli) (built: Sep 15 2022 22:53:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3-4ubuntu2.14, Copyright (c), by Zend Technologies

This is now verified.

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (php7.4/7.4.3-4ubuntu2.14)

All autopkgtests for the newly accepted php7.4 (7.4.3-4ubuntu2.14) for focal have finished running.
The following regressions have been reported in tests triggered by the package:

php-luasandbox/3.0.3-2build2 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/focal/update_excuses.html#php7.4

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

The failing test above (focal) was also a flaky one. I re-triggered it and it passed.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php8.1 - 8.1.2-1ubuntu2.6

---------------
php8.1 (8.1.2-1ubuntu2.6) jammy; urgency=medium

  * d/rules: fix PHP_EXTRA_VERSION setting. (LP: #1989196)
  * Test PHP_EXTRA_VERSION setting with autopkgtest.

 -- Athos Ribeiro <email address hidden> Thu, 15 Sep 2022 08:30:49 -0300

Changed in php8.1 (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for php8.1 has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks, Lukasz.

This should be enough to drive the drupal issue [1] forward. Thank you, kraut and mark burdett for pushing this forward and driving the effort on the drupal side :)

https://www.drupal.org/project/drupal/issues/3307248

Revision history for this message
Kraut.Hosting (kraut.hosting) wrote :

@Athos Thanks for good coop :) Nice pushing inter-community!

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Re-setting the focal bug status since a security update superseeded the package in -proposed. This is OK, since initally we were willing to add a block-proposed tag to the focal SRU anyway.

I will now add the block-proposed to focal to avoid sending users yet another update there since the security one just landed.

Changed in php7.4 (Ubuntu Focal):
status: Fix Committed → Triaged
tags: added: block-proposed-focal
removed: server-todo
Changed in php7.4 (Ubuntu Focal):
status: Triaged → In Progress
tags: added: verification-needed verification-needed-focal
removed: verification-done verification-done-focal
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

We needed to combine this change with LP: #1999598. I will now remobe the block-proposed tag so from this one :)

tags: removed: block-proposed-focal
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Please test proposed package

Hello Athos, or anyone else affected,

Accepted php7.4 into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/php7.4/7.4.3-4ubuntu2.16 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in php7.4 (Ubuntu Focal):
status: In Progress → Fix Committed
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (php7.4/7.4.3-4ubuntu2.16)

All autopkgtests for the newly accepted php7.4 (7.4.3-4ubuntu2.16) for focal have finished running.
The following regressions have been reported in tests triggered by the package:

php-excimer/1.0.0~git20190913.d82eaf7-1build1 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/focal/update_excuses.html#php7.4

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Matthew Ruffell (mruffell) wrote :

Performing verification for Focal.

I started a fresh Focal VM, and installed php7.4 7.4.3-4ubuntu2.15 from -updates.

From there, I checked all of its version numbers:

$ sudo apt-cache policy php7.4
php7.4:
  Installed: 7.4.3-4ubuntu2.15

$ php --version
PHP 7.4.3 (cli) (built: Nov 2 2022 09:53:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

$ cat phpver.php
<?php
echo PHP_VERSION;
echo "\n";
echo PHP_VERSION_ID;
?>
$ php phpver.php
7.4.3
70403

$ cat ./php_bash.sh
PKGVERSION=$(dpkg-query --showformat='${Version}\n' --show php7.4-cli)
PHPVERSION=$(php7.4 --version | head -1 | cut -d ' ' -f2)

if [ "${PKGVERSION}" != "${PHPVERSION}" ]; then
 echo "package version '${PKGVERSION}' does not match php CLI version '${PHPVERSION}'"
 exit 1
fi
$ ./php_bash.sh
package version '7.4.3-4ubuntu2.15' does not match php CLI version '7.4.3'

I then enabled -proposed, and installed php 7.4.3-4ubuntu2.16, and re-ran the above:

$ sudo apt-cache policy php7.4
php7.4:
  Installed: 7.4.3-4ubuntu2.16

$ php --version
PHP 7.4.3-4ubuntu2.16 (cli) (built: Sep 15 2022 22:53:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3-4ubuntu2.16, Copyright (c), by Zend Technologies

$ cat phpver.php
<?php
echo PHP_VERSION;
echo "\n";
echo PHP_VERSION_ID;
?>
$ php phpver.php
7.4.3-4ubuntu2.16
70403

$ cat ./php_bash.sh
PKGVERSION=$(dpkg-query --showformat='${Version}\n' --show php7.4-cli)
PHPVERSION=$(php7.4 --version | head -1 | cut -d ' ' -f2)

if [ "${PKGVERSION}" != "${PHPVERSION}" ]; then
 echo "package version '${PKGVERSION}' does not match php CLI version '${PHPVERSION}'"
 exit 1
fi
$ ./php_bash.sh

The last command had no output indicating the strings were the same.

The package in -proposed solves the problem, happy to mark as verified for Focal.

tags: added: verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks!

tags: added: verification-done
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php7.4 - 7.4.3-4ubuntu2.16

---------------
php7.4 (7.4.3-4ubuntu2.16) focal; urgency=medium

  [ Athos Ribeiro ]
  * d/rules: fix PHP_EXTRA_VERSION setting. (LP: #1989196)
  * Test PHP_EXTRA_VERSION setting with autopkgtest.

  [ Matthew Ruffell ]
  * No longer throw an error when serializing uninitialized typed
    properties with __sleep(), which makes serializing objects with
    __sleep() behave the same as serializing objects without
    __sleep(). (LP: #1999598)
    - d/p/lp-1999598-Fix-bug-79447.patch

 -- Athos Ribeiro <email address hidden> Thu, 15 Sep 2022 19:53:21 -0300

Changed in php7.4 (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

PHP8.2 was allowed in mantic without this patch, which was not accepted in Debian yet. Since this is a regression, I do not believe this needs a FFe for a mantic fix.

Changed in php8.2 (Ubuntu):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
status: New → In Progress
tags: added: server-todo
Changed in php8.2 (Ubuntu):
status: In Progress → Triaged
assignee: Athos Ribeiro (athos-ribeiro) → nobody
Changed in php8.2 (Ubuntu):
status: Triaged → Fix Committed
Changed in php8.2 (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.