I'd expect the two versions of libapache2-mod-php7 to have a conflicts statement to enforce ordering.
Checking the same on 7.0 (xenial) -> 7.2 (bionic)
I'd expect this bug would have come up before if it was broken there as well, so that should server as a good comparison.
There it is the same:
$ grep 'mod-php' /var/log/dist-upgrade/apt-term.log
Selecting previously unselected package libapache2-mod-php7.2.
Preparing to unpack .../libapache2-mod-php7.2_7.2.24-0ubuntu0.18.04.1_amd64.deb ...
Unpacking libapache2-mod-php7.2 (7.2.24-0ubuntu0.18.04.1) ...
Preparing to unpack .../libapache2-mod-php_1%3a7.2+60ubuntu1_all.deb ...
Unpacking libapache2-mod-php (1:7.2+60ubuntu1) over (1:7.0+35ubuntu6.1) ...
Setting up libapache2-mod-php7.2 (7.2.24-0ubuntu0.18.04.1) ...
>> libapache2-mod-php7.2: php7.0 module already enabled, not enabling PHP 7.2
Setting up libapache2-mod-php (1:7.2+60ubuntu1) ...
Removing libapache2-mod-php7.0 (7.0.33-0ubuntu0.16.04.7) ...
Module php7.0 disabled.^M
apache2_invoke prerm: Disable module php7.0^M
Purging configuration files for libapache2-mod-php7.0 (7.0.33-0ubuntu0.16.04.7) ...
And the server is serving the PHP code now ...
It seems to affect all major version bumps (unless I'm missing a detail and doing things wrong)
I'd expect the two versions of libapache2-mod-php7 to have a conflicts statement to enforce ordering.
Checking the same on 7.0 (xenial) -> 7.2 (bionic)
I'd expect this bug would have come up before if it was broken there as well, so that should server as a good comparison.
There it is the same:
$ grep 'mod-php' /var/log/ dist-upgrade/ apt-term. log mod-php7. 2. mod-php7. 2_7.2.24- 0ubuntu0. 18.04.1_ amd64.deb ... mod-php7. 2 (7.2.24- 0ubuntu0. 18.04.1) ... mod-php_ 1%3a7.2+ 60ubuntu1_ all.deb ... mod-php7. 2 (7.2.24- 0ubuntu0. 18.04.1) ... mod-php7. 2: php7.0 module already enabled, not enabling PHP 7.2 mod-php7. 0 (7.0.33- 0ubuntu0. 16.04.7) ... mod-php7. 0 (7.0.33- 0ubuntu0. 16.04.7) ...
Selecting previously unselected package libapache2-
Preparing to unpack .../libapache2-
Unpacking libapache2-
Preparing to unpack .../libapache2-
Unpacking libapache2-mod-php (1:7.2+60ubuntu1) over (1:7.0+35ubuntu6.1) ...
Setting up libapache2-
>> libapache2-
Setting up libapache2-mod-php (1:7.2+60ubuntu1) ...
Removing libapache2-
Module php7.0 disabled.^M
apache2_invoke prerm: Disable module php7.0^M
Purging configuration files for libapache2-
And the server is serving the PHP code now ...
It seems to affect all major version bumps (unless I'm missing a detail and doing things wrong)