ircmaxell / ircmaxell/php-cfg

Function uses global variable causes inconsistency in variable id

Open
#24 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
247
Forks
45
Avg merge
1m
Merged PRs (30d)
1

Description

Example:

<?php
$global = "B";
function TestTaintOnFunction() {
    global $global;
    $secondVar = "2";
    echo $global;
}

Results in:

    Expr_Assign
        var: Var#1<$global>
        expr: LITERAL('B')
        result: Var#2
    Stmt_Function<TestTaintOnFunction>

Function TestTaintOnFunction():
Block#1
    Terminal_GlobalVar
        var: LITERAL('global')
    Expr_Assign
        var: Var#1<$secondVar>
        expr: LITERAL('2')
        result: Var#2
    Terminal_Echo
        expr: Var#3<$global>

Anyway to make the id consistent?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the TestTaintOnFunction example and compare the generated control-flow graph for the global assignment, the function's global variable, and the echo expression. Trace how variable IDs are assigned across those entries; done means the same variable is represented consistently wherever $global is referenced.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.