ircmaxell/php-cfg

Issues with isset function

quanyang opened this issue · 4 comments

Currently the CFG is showing isset as:

    Expr_Isset
        result: Var#9

However, this would not give information on what is being checked by the isset function.

Not sure if this would be considered an issue to you guys, but I kind of solved it by changing isset to an operand instead of block.

nikic commented

Fixed with 741a668 by using a vars subnode, which is an array of variables that are checked.

In the future we should instread define Expr\Isset_ to be single-argument and desugar multi-arg issets into single-arg ones combined via && operations. However issue #10 should be fixed before doing that.

Same issue with empty function and maybe others.

nikic commented

@quanyang Fixed to use operand in 1744d0b.

The fact that it was done the same way there makes me think that it was intentional. Maybe this was intended as some weird way to handle the fact that these uses do not generate notices...

@nikic hmm the AST generated by PHP-Parser does show the parameter variable.

You might be right that it could be intended, however I'm looking at performing some further analysis using the CFG generated by php-cfg, and these information could be crucial.

Anyway thanks for fixing!