[xdebug-general] Re: Code coverage of if statements

From: Derick Rethans <derick[@]xdebug.org>
Date: Mon, 22 Dec 2008 14:31:06 +0100 (CET)

On Mon, 22 Dec 2008, Mike Richardson wrote:

> which seems wrong since line 6 is *not* executing (but line 5 is)? If I call
> f(1) instead I get lines 6, 12 and 13 executed, which is right; if I call
> f(0) and have braces on lines 5 and 7 then line 6 is not reported as
> executed. If this an Xdebug bug or a PHP limitation?

It's a PHP limitation. If you see what happens internally, you see that
it only "Generates" code for line 2, 6, 8 and 9:

filename: /tmp/vld.php
function name: f
number of ops: 9
compiled vars: !0 = $a
line # op fetch ext return
operands
-------------------------------------------------------------------------------
   2 0 EXT_NOP
         1 RECV 1
   6 2 EXT_STMT
         3 JMPZ !0, ->6
         4 RETURN 1
         5* JMP ->7
   8 6 RETURN 2
   9 7* EXT_STMT
         8* RETURN null

regards,
Derick

-- 
Like Xdebug? Send a postcard: http://derickrethans.nl/xdebug_2_released.php
Xdebug | http://xdebug.org | xdebug-general@lists.xdebug.org
Received on Mon Dec 22 2008 - 14:31:06 GMT

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST