[xdebug-general] Re: 2 Queries about XDebug 2.0.0rc1

From: Dave Kelsey <d_kelsey[@]uk.ibm.com>
Date: Tue, 17 Oct 2006 16:15:38 +0100

Hi Derick, many thanks for the response. I have raised the defect. In the
second case, here is an example
standalone program I quickly tested with.

---------------------------------------------------------------------
<?php

$level0_a = "Level0_a";
$prog_global = date('Y-m-d\TH:i:s0');
level1();

function level1() {
      global $prog_global;
    echo "prog_global at level1 = " .$prog_global ."\n";
    echo "level0_a at level1 = " . $level0_a . "\n";
      $level1_a = "Level1_a";
      $level1_b = "Level1_b";
      $level1_c = "Level1_c";
      $level1_d = "Level1_d";
      $level1_e = "Level1_e";
      $level1_f = "Level1_f";
      level2();

}

function level2() {
      global $prog_global;
      global $level2_a;
    echo "prog_global at level2 = " .$prog_global ."\n";

      $level2_a = "Level2_a";
      $level2_b = "Level2_b";
      $level2_c = "Level2_c";
      $level2_d = "Level2_d";
      level3();

}

function level3() {
      global $level2_a;
      echo "level2_a = " .$level2_a ."\n";
      echo "prog_global at level3 = " .$prog_global ."\n";
      $level3_a = "Level3_a";
      $level3_b = "Level3_b";
      $level3_c = "Level3_c";
      $level3_d = "Level3_d";

      echo "reached the end";
}
?>

--------------------------------------------------------------------------------------------
what I did was set a break point at the "reached the end" echo line in
function level3().

When I do a get of the global variables I get back the following variables

level0_a = "level0_a"
prog_global = "2006-10-17T15:59:400"
_ENV
_GET
_POST
_COOKIE
_REQUEST
_FILES
_SERVER

The last 7 I expect, but I don't to see level0_a or prog_global, as they
are not available to
that function.

In fact if a do a context get for the variables in the stack frame that
represents where I am in level3, I get the variables

level2_a="level2_a"
level3_a="level3_a"
level3_b="level3_b"
level3_c="level3_c"
level3_d="level3_d"
prog_global - uninitialized

What I am trying to show is all the variables that are available to the
level3 function, so all the super globals are available
all the local variables are available, but level0_a should not be present
and prog_global shows uninitialized which is a bit
more strange as I get the message "Notice: Undefined variable: prog_global
in C:\udata-eclipse\phpide025\testXdebug\PhpCode\FunctionVarTest.php on
line 39" so wouldn't expect to se prog_global as a local variable for that
context.

When I display information about this level, I query all the gobals, then
the local variables at that context depth and this is where
the globals seems to be include the top level context local variables as
well.

I hope this helps.

Best regards
Dave Kelsey

On Mon, 16 Oct 2006, Dave Kelsey wrote:

>
> Hi, I have been playing around with XDebug (really like what I see so
far)
> and came across a couple of issues which maybe someone can help me with
>
> 1. If I invoke a PHP script fom a browser with XDEBUG_SESSION_STOP, I see
> that XDebug tries to create a socket to a debug server (in the same
manner
> as XDEBUG_SESSION_START does). I was not expecting this to happen as a
STOP
> implies that I don't wish to continue debugging. Is this the expected
> behaviour on a STOP ?

I can't see a reason for this. Could you please file a bug report this
at http://bugs.xdebug.org ?

> 2. When I get the variables for a global context (context_get -c 1) It
> also appears to include all the local variables from the top stack frame,
> but these variables
> are local and not global so I wasn't expecting them to be listed. Is this
> the expected behaviour ?

Hmm, what do you mean with the top stack frame? The scope that is the
current execution scope or the one that is the scripts entry point in
the request?

regards,
Derick
Received on Tue Oct 17 2006 - 17:13:27 BST

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