phpquery always returns 0

Bug #1699659 reported by Jason Short on 2017-06-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php-defaults (Debian)
Fix Released
php-defaults (Ubuntu)
Nish Aravamudan

Bug Description


 * various PHP postinst uses php-defaults' scripts for determing what actions to perform.
 * The phpquery script has an error that does not propogate state correctly.

[Test Case]

[Regression Potential]

 * This is pure bug-fix backport from version 44 (in yakkety and on) to xenial. The regression potential is very low; most likely people were seeing the issue as reported in this bug and manually, e.g., disabling modules again on every upgrade. This will actually avoid having to do that.


In the course of diagnosing an issue with a PHP module (xdebug in this case) kept re-enabling itself during upgrades of libapache2-mod-php7.0, I found the following:

1. libapache2-mod-php7.0 postscript sources /usr/lib/php/php-maintscript-helper from php-common to re-enable modules that have not been administratively disabled.

2. php-maintscript-helper calls phpenmod based on the output and return codes of phpquery

3. phpquery calls its own action() function, which initializes the $ret variable to 0

4. phpquery action() calls into various other functions in the script, and sets the $ret variable based on their returns

5. phpquery action() returns 0

6. php-maintscript-helper correspondingly calls phpenmod on all available php modules for the apache2 SAPI

Source link for xenial:

the following addition to action() after the esac is necessary to bubble up the internal functions' returns:

return $ret

Nish Aravamudan (nacc) on 2017-06-22
Changed in php-defaults (Ubuntu Yakkety):
status: New → Fix Released
Changed in php-defaults (Ubuntu Zesty):
status: New → Fix Released
Changed in php-defaults (Ubuntu Artful):
status: New → Fix Released
Nish Aravamudan (nacc) wrote :

Hello and thank you for filing this bug report! This was fixed in src:php-defaults 44, which is in Y and on. I will submit a SRU for this to X.

Changed in php-defaults (Ubuntu Xenial):
status: New → Triaged
assignee: nobody → Nish Aravamudan (nacc)
Changed in php-defaults (Debian):
status: Unknown → Fix Released
Nish Aravamudan (nacc) wrote :

I have uploaded a potential fixed php-defaults to Could you please test and respond back if it fixes the issue for you?

Changed in php-defaults (Ubuntu Xenial):
status: Triaged → In Progress
Jason Short (shortj) wrote :


Get:1 xenial/main amd64 php-common all 1:35ubuntu6.1~ppa1 [12.3 kB]

# phpquery -v 7.0 -s apache2 -m xdebug
No module matches xdebug (Disabled for apache2 by local administrator)

# echo $?

Nish Aravamudan (nacc) on 2017-06-22
description: updated
Robie Basak (racb) wrote :

Accepting, but please provide a public test case and mark verification-done-xenial only once that case is fixed by the proposed update.

Changed in php-defaults (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-xenial

Hello Jason, or anyone else affected,

Accepted php-defaults into xenial-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See 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 and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at . Thank you in advance!

Jason Short (shortj) wrote :


apt-get install php-common excerpt:

Get:1 xenial-proposed/main amd64 php-common all 1:35ubuntu6.1 [10.8 kB]


2017-07-25 15:22:52 status installed php-common:all 1:35ubuntu6.1

# apt-get install --reinstall php-xdebug
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 53 not upgraded.
Need to get 0 B/316 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 144094 files and directories currently installed.)
Preparing to unpack .../php-xdebug_2.4.0-1_amd64.deb ...
Unpacking php-xdebug (2.4.0-1) over (2.4.0-1) ...
Setting up php-xdebug (2.4.0-1) ...
WARNING: Not enabling the xdebug module for PHP 7.0 cli SAPI since the module
WARNING: was disabled by local administrator.
WARNING: Not enabling the xdebug module for PHP 7.0 apache2 SAPI since the module
WARNING: was disabled by local administrator.
php_invoke xdebug: no action - module was disabled by maintainer for PHP 7.0 cli SAPI

tags: added: verification-done-xenial
removed: verification-needed verification-needed-xenial
Jason Short (shortj) wrote :

racb, the requested tag has been set, what else do you need from me here?

Nish Aravamudan (nacc) wrote :

@shortj, packages in -proposed take 7 days to be tested before they are propogated. Thank you for updating the tags correctly, in a few more days, the SRU team should release the update.

Robie Basak (racb) wrote :

There is a big list of autopkgtest failures in against php-defaults. Please could someone check to see if they are relevant to this update, or have always been failing, etc?

Łukasz Zemczak (sil2100) wrote :

I have checked the remaining php-horde-timezone autopkgtests that are failing. I re-run some of them with only what's in the archive and it seems the test suite for that package is currently broken. With this I am accepting the package to -updates.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php-defaults - 35ubuntu6.1

php-defaults (35ubuntu6.1) xenial; urgency=medium

  * phpquery: Don't lose status from check_mod() (Closes #834189).
    - Backport from 44.
    - LP: #1699659.

 -- Nishanth Aravamudan <email address hidden> Thu, 22 Jun 2017 08:47:57 -0700

Changed in php-defaults (Ubuntu Xenial):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for php-defaults has completed successfully and the package has now been 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.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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