derickr / vld

BSD 2-Clause "Simplified" License
464 stars 87 forks source link

When the op of the new is variable, the dump code is not correct #65

Closed jimmyleeeeee closed 4 years ago

jimmyleeeeee commented 4 years ago

when the code is below: class Test { private $_walkers = array();

public function addTreeWalker($walkerClass)
{
    $this->_walkers[] = new $walkerClass();    The operands of the new is  <unknown>.
}

 public function addTreeWalker1($walkerClass)
{
    $Classname=$walkerClass."Service";
    $ServiceObject=new $Classname;     The operands of new is 'Service'.
    return $ServiceObject;
}

}

If the op of new is a variable, the operands of new in dump is not correct. Some cases the operands of the new is < undef >, sometimes, it is < unknown >, sometimes, it is a string. Before the latest update, the code can be dumped correctly.

derickr commented 4 years ago

Can you please stop continuing to ask when I get to issues? I get to it when I have time, and that gets less likely when poor quality tickets.

In this case, your code doesn't format, there is not original output, no pointer to what goes wrong in that original output, no PHP version, no mention on where opcache is on or off, etc.

If you create tickets which explain the problem clearly, then things will go faster, but still only when I get to it.

jimmyleeeeee commented 4 years ago

Hi, Derick I am sorry that I don't make this clear. I hope it will be clear this time. I have formatted the code as below. `class Test { private $_walkers = array();

public function addTreeWalker($walkerClass)
{
    $this->_walkers[] = new $walkerClass();
}

 public function addTreeWalker1($walkerClass)
{
    $Classname=$walkerClass . "Service";
    $ServiceObject = new $Classname;
    return $ServiceObject;
}

}`

The PHP version is 7.4.4. I run the command "php -dextension=vld.so -dvld.active=1 -dvld.dump_paths=0 -dvld.execute=0 testcode.php" to review the opcode.

For code of "new $walkerClass()", the operand of the new in opcode is < unknown >. For code of "new $Classname", The operand of new in opcode is 'Service'.