|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73484 phpdbg executes code incorrectly
Submitted: 2016-11-09 21:00 UTC Modified: 2016-11-14 14:39 UTC
From: deviantintegral at gmail dot com Assigned: bwoebi (profile)
Status: Not a bug Package: phpdbg
PHP Version: 7.1.0RC5 OS: Linux
Private report: No CVE-ID: None
 [2016-11-09 21:00 UTC] deviantintegral at gmail dot com
I've been attempting to use phpdbg for code coverage reports with phpunit. I've had rather strange behaviour with it running Drupal 8's test suite. phpunit 4.8 tests simply stop running, with no error or segfault. I switched over to phpunit 5.4, so the warnings below can be ignored for now.

Under PHP 7, tests pass, but on further inspection, the assertions are not all being run correctly. For example, under php7:

Time: 14.94 seconds, Memory: 120.00Mb

OK (15 tests, 176 assertions

Under phpdbg:

Time: 5.31 seconds, Memory: 140.00Mb

OK (15 tests, 8 assertions)

This also affects PHP7.0, as I see similar behaviour there in the Ubuntu PPA for it:

Test script:
Here's a Dockerfile to replicate this bug against the latest RC:

FROM php:7.1-rc
RUN curl -OJ
RUN tar xzvf drupal-8.2.2.tar.gz
ENV SIMPLETEST_DB="sqlite://localhost//tmp/drupal.sqlite"
CMD cd drupal-8.2.2 \
  && php vendor/bin/phpunit --verbose --debug -c core/phpunit.xml.dist --group aggregator \
  && phpdbg -rrq vendor/bin/phpunit --verbose --debug -c core/phpunit.xml.dist --group aggregator

Build it with docker build, and then use docker run <image id> and note that the assertion counts are different.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-13 06:57 UTC]
-Assigned To: +Assigned To: bwoebi
 [2016-11-13 16:30 UTC]
-Status: Assigned +Status: Not a bug
 [2016-11-13 16:30 UTC]
This is not a PHP bug.

This is phpunit reading from php://input (which is used for e.g. POST bodies) in src/Util/PHP/eval-stdin.php instead of php://stdin, effectively reading an empty string and thus not executing anything.
 [2016-11-14 14:26 UTC] deviantintegral at gmail dot com
Thanks! I'll followup with phpunit. I'm curious, why would this behaviour be different between the PHP CLI and phpdbg? Is there some sort of mapping of stdin to input that the cli binary does? I'm a little surprised you don't end up with an empty body there as well.
 [2016-11-14 14:39 UTC]
Just for the record, I already have fixed it in phpunit:

Also, the bug was inside phpdbg specific code (i.e. inside an if (PHP_SAPI == 'phpdbg')), that's why.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 08:01:32 2024 UTC