Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Reducer/BinaryOpReducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,16 @@ public function reduceMod(BinaryOp\Mod $node)
{ return $this->postProcess($node, $this->left($node) % $this->right($node)); }

public function reduceMul(BinaryOp\Mul $node)
{ return $this->postProcess($node, $this->left($node) * $this->right($node)); }
{
$left = $this->left($node);
$right = $this->right($node);

if (is_numeric($left) && is_numeric($right)) {
return $this->postProcess($node, $left * $right);
}

return null;
}
public function reduceNotEqual(BinaryOp\NotEqual $node)
{ return $this->postProcess($node, $this->left($node) != $this->right($node)); }

Expand Down
4 changes: 2 additions & 2 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Utils
{
public static function scalarToNode($value, $attrs = array())
{
if (!is_array($value)) { // Do this for arrays later
if (is_scalar($value) || $value === null) { // Do this for arrays later
$attrs[AttrName::VALUE] = new ScalarValue($value);
}
if (is_int($value)) {
Expand Down Expand Up @@ -44,7 +44,7 @@ public static function scalarToNode($value, $attrs = array())
$attrs[AttrName::VALUE] = new ArrayVal($valArray);
return new Node\Expr\Array_($items, $attrs);
}
throw new \Exception("Unknown value type");
return null; // Skip unknown value types silently to protect against future weird types without killing deobfuscation
}

public static function getValueRef(Node $node)
Expand Down