Skip to content

Commit

Permalink
fix bug with use without alias
Browse files Browse the repository at this point in the history
  • Loading branch information
pk-fr committed Mar 2, 2020
1 parent 018064f commit eba66eb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions include/classes/parser_extensions/my_node_visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,20 +529,23 @@ public function leaveNode(PhpParser\Node $node)
{
if ($conf->obfuscate_function_name || $conf->obfuscate_class_name)
{
if (!$conf->obfuscate_function_name || !$conf->obfuscate_class_name)
if (isset($node->alias))
{
fprintf(STDERR, "Warning:[use alias] cannot determine at compile time if it is a function or a class alias".PHP_EOL."\tyou must obfuscate both functions and classes or none...".PHP_EOL."\tObfuscated code may not work!".PHP_EOL);
}
$scrambler = $t_scrambler['function_or_class'];
$name = $this->get_identifier_name($node->alias);
if ( is_string($name) && (strlen($name) !== 0) )
{
$r = $scrambler->scramble($name);
if ($r!==$name)
if (!$conf->obfuscate_function_name || !$conf->obfuscate_class_name)
{
//$node->alias = $r;
$this->set_identifier_name($node->alias,$r);
$node_modified = true;
fprintf(STDERR, "Warning:[use alias] cannot determine at compile time if it is a function or a class alias".PHP_EOL."\tyou must obfuscate both functions and classes or none...".PHP_EOL."\tObfuscated code may not work!".PHP_EOL);
}
$scrambler = $t_scrambler['function_or_class'];
$name = $this->get_identifier_name($node->alias);
if ( is_string($name) && (strlen($name) !== 0) )
{
$r = $scrambler->scramble($name);
if ($r!==$name)
{
//$node->alias = $r;
$this->set_identifier_name($node->alias,$r);
$node_modified = true;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
// Use and abuse at your own risks.
//========================================================================

$yakpro_po_version = "2.0.7";
$yakpro_po_version = "2.0.8";

?>

0 comments on commit eba66eb

Please sign in to comment.