Skip to content

Commit

Permalink
fix issue with defined() function
Browse files Browse the repository at this point in the history
  • Loading branch information
pk-fr committed May 26, 2020
1 parent 9fcb688 commit 4d198ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/classes/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Author: Pascal KISSIAN
// Resume: http://pascal.kissian.net
//
// Copyright (c) 2015-2018 Pascal KISSIAN
// Copyright (c) 2015-2020 Pascal KISSIAN
//
// Published under the MIT License
// Consider it as a proof of concept!
Expand Down Expand Up @@ -105,7 +105,7 @@ class Config
function __construct()
{
$this->comment .= "/* __________________________________________________".PHP_EOL;
$this->comment .= " | Obfuscated by YAK Pro - Php Obfuscator %-5.5s |".PHP_EOL;
$this->comment .= " | Obfuscated by YAK Pro - Php Obfuscator %-6.6s |".PHP_EOL;
$this->comment .= " | on %s |".PHP_EOL;
$this->comment .= " | GitHub: https://github.com/pk-fr/yakpro-po |".PHP_EOL;
$this->comment .= " |__________________________________________________|".PHP_EOL;
Expand Down
11 changes: 6 additions & 5 deletions include/classes/parser_extensions/my_node_visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,14 @@ public function leaveNode(PhpParser\Node $node)
{
if (isset($node->name->parts)) // not set when indirect call (i.e.function name is a variable value!)
{
$parts = $node->name->parts;
$name = $parts[count($parts)-1];
if ( is_string($name) && ($name=='define') )
$parts = $node->name->parts;
$fn_name = $parts[count($parts)-1];
if ( is_string($fn_name) && ( ($fn_name=='define') || ($fn_name=='defined') ) )
{
for($ok=false;;)
{
if (!isset($node->args[0]->value)) break;
if (count($node->args)!=2) break;
if ( ($fn_name=='define') && (count($node->args)!=2) ) break;
$arg = $node->args[0]->value; if (! ($arg instanceof PhpParser\Node\Scalar\String_) ) break;
$name = $arg->value; if (! is_string($name) || (strlen($name) == 0) ) break;
$ok = true;
Expand All @@ -459,7 +459,8 @@ public function leaveNode(PhpParser\Node $node)
}
if (!$ok)
{
throw new Exception("Error: your use of define() function is not compatible with yakpro-po!".PHP_EOL."\tOnly 2 parameters, when first is a literal string is allowed...");
if ($fn_name=='define') throw new Exception("Error: your use of $fn_name() function is not compatible with yakpro-po!".PHP_EOL."\tOnly 2 parameters, when first is a literal string is allowed...");
else throw new Exception("Error: your use of $fn_name() function is not compatible with yakpro-po!".PHP_EOL."\tOnly 1 literal string parameter is allowed...");
}
}
}
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.10";
$yakpro_po_version = "2.0.11";

?>

0 comments on commit 4d198ba

Please sign in to comment.