View Issue Details

IDProjectCategoryView StatusLast Update
0001466XdebugCode Coveragepublic2017-09-24 19:41
ReporterCJ Dennis Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
Product Version2.5.5 
Summary0001466: No code coverage for "elseif (is_string($value))" lines
Description

The line elseif (is_string($value)) { never gets covered if the single keyword elseif is used with one of the is_string(), is_integer(), is_bool(), is_array(), etc. functions. Changing the keyword to the two keywords else and if produces the correct results.

Steps To Reproduce

Run the following code:

<?php
$value = 'foo';
xdebug_start_code_coverage();
if (false) {
echo 'What?';
}
elseif (is_string($value)) {
echo 'OK!';
}
var_dump(xdebug_get_code_coverage());
?>

Expected results:
[
4 => 1,
7 => 1,
8 => 1,
10 => 1
]

Actual results:
[
4 => 1,
8 => 1,
10 => 1
]

(line 7 is incorrectly missing)

If line 7 is changed to else if (is_string($value)) { (with a space between else and if) or elseif ($value) {, it is included in the coverage results.

TagsNo tags attached.
Operating SystemWindows 10
PHP Version7.1.5-7.1.9

Activities

derick

2017-09-21 10:20

administrator   ~0004418

I can not reproduce this with Xdebug 2.5.5 and PHP 7.1.9:

derick@singlemalt:/tmp $ php /tmp/1466.php
OK!/tmp/1466.php:10:
array(1) {
'/tmp/1466.php' =>
array(4) {
[4] =>
int(1)
[7] =>
int(1)
[8] =>
int(1)
[10] =>
int(1)
}
}

It shows the right output.

This is the same issue as 0001439, which got fixed in 2.5.5. Are you sure you're running the latest version and not for example 2.5.4?

CJ Dennis

2017-09-21 11:15

reporter   ~0004419

I downloaded the latest Xdebug (2.5.5), but when I double-checked, I'd forgotten to update php.ini and it was still using 2.5.4!

So, you're correct, it's already fixed! Thank you!

derick

2017-09-24 19:41

administrator   ~0004427

Was already fixed in 2.5.5.