PhpStorm wont debbug my if(isset) code

Hi there all,

I got an issue with the PhpStorm debbuging feature...in my firefox I use the easiestXdebug 2.1 Plug-In and actually, most runs fine. Well, in my PHP Code I set some breakpoints beginning
at an if(isset (.....code)) line. So...logical...the debugger does not evaluate the code statements inside the block until this particular $var is set.

Normally I suppose to do something to make this $var exist (here clicking on a link)...

Question:
How do I persuade PhpStorm to evaluate that code block or what is necessary to tell the IDE that this if(isset()) is now true ???


Thanks for each advice

1 comment
Comment actions Permalink

Hi there,

Well -- AFAIK you cannot force debugger to get inside that code block just like that as it's only done by evaluating the actual code.

In any case: it depends on the actual conditions in if statement . For example, this is what you can do for array keys (can be applied to variables as well):

<?php
$array = [
    0 => 'zero',
    1 => 'one',
    2 => 'two'
];


$array[1] = 'one-one'; // breakpoint here


if (isset($array[5])) {
    $array[20] = 'twenty';
}


Before executing "if (isset($array[5])) {" line, use Evaluate Expression functionality:

screen01.png

And now it's working:

screen02.png

0

Please sign in to leave a comment.