MantisBT - Xdebug
View Issue Details
0001413XdebugCode Coveragepublic2017-04-08 12:232017-04-16 01:17
olvlvl 
derick 
normalminoralways
closedfixed 
MacMacOS10.12.03
2.5.1 
2.5.2 
MacOS
7.1.0-7.1.4
0001413: Line is missing from code coverage
I have two classes that are almost identical: Require and Require2. The first one inherits a constant from an interface, the second defines the constant. The line using the inherited constant appears as not covered, while the other one does:

    public function normalize_params(array $params)
    {
        return array_merge([

            self::OPTION_STOP_ON_ERROR => true

        ], $params);
    }
Run the following command with the attached files:

    phpunit --coverage-html build/coverage

Now check build/coverage/Required.php.html#16, the line appears as "Not executed", while build/coverage/Required2.php.html#16 is fine.
With OpCache disabled the line appears as "Not executed" in both classes.

PHP was installed with "brew".
No tags attached.
zip xdebug-bug-1.zip (11,566) 2017-04-08 12:23
https://bugs.xdebug.org/file_download.php?file_id=373&type=bug
Issue History
2017-04-08 12:23olvlvlNew Issue
2017-04-08 12:23olvlvlFile Added: xdebug-bug-1.zip
2017-04-13 18:47derickNote Added: 0004259
2017-04-13 18:47derickAssigned To => derick
2017-04-13 18:47derickStatusnew => feedback
2017-04-14 00:46olvlvlNote Added: 0004260
2017-04-14 00:46olvlvlStatusfeedback => assigned
2017-04-15 15:48derickNote Added: 0004263
2017-04-16 00:28derickNote Added: 0004264
2017-04-16 00:28derickStatusassigned => closed
2017-04-16 00:28derickResolutionopen => fixed
2017-04-16 00:28derickFixed in Version => 2.5.2
2017-04-16 01:17olvlvlNote Added: 0004265

Notes
(0004259)
derick   
2017-04-13 18:47   
I tried reproducing this, but I can't. In both situations (opcache on, or off), both lines "16" in Required.php and Required2.php are marked as executable.

Can you please show the output of:

phpunit --version
php -v
php -m

cheers,
Derick
(0004260)
olvlvl   
2017-04-14 00:46   
Here:

PHPUnit 5.7.9 by Sebastian Bergmann and contributors.

PHP 7.1.3 (cli) (built: Mar 28 2017 21:57:28) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.3, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.5.1, Copyright (c) 2002-2017, by Derick Rethans

[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
ldap
libxml
mbstring
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache
(0004263)
derick   
2017-04-15 15:48   
OK. With PHP 7.1.3 I can reproduce this. With 7.1.4, I can not. It looks like PHP itself changed something. I am suspecting it is the fix for bug #69676 (https://bugs.php.net/bug.php?id=69676 [^]). This fix, seems to have caused some line numbers to go wrong. I can fix the symptom in Xdebug, but there is something more going wrong in PHP too I believe.
(0004264)
derick   
2017-04-16 00:28   
Fixed for 2.5.2.

And thanks for the excellent report!
(0004265)
olvlvl   
2017-04-16 01:17   
GTK there's already a fix. Thanks for your excellent work.